Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.9.2-alpha0

* Add direct call for `ti_do_root_chain` _(small performance upgrade)_, pr #453.

# v1.9.1

* Skip `ti_do_expression` where possible for performance increase, pr #452.
Expand Down
1 change: 1 addition & 0 deletions inc/ti/do.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ int ti_do_enum_get(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_thing(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_array(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_paranthesis(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_root_chain(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_operation(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_bit_sl(ti_query_t * query, cleri_node_t * nd, ex_t * e);
int ti_do_bit_sr(ti_query_t * query, cleri_node_t * nd, ex_t * e);
Expand Down
4 changes: 2 additions & 2 deletions inc/ti/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define TI_VERSION_MAJOR 1
#define TI_VERSION_MINOR 9
#define TI_VERSION_PATCH 1
#define TI_VERSION_PATCH 2

/* The syntax version is used to test compatibility with functions
* using the `ti_nodes_check_syntax()` function */
Expand All @@ -25,7 +25,7 @@
* "-rc0"
* ""
*/
#define TI_VERSION_PRE_RELEASE ""
#define TI_VERSION_PRE_RELEASE "-alpha0"

#define TI_MAINTAINER \
"Jeroen van der Heijden <jeroen@cesbit.com>"
Expand Down
18 changes: 18 additions & 0 deletions src/ti/do.c
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,24 @@ int ti_do_paranthesis(ti_query_t * query, cleri_node_t * nd, ex_t * e)
return ti_do_statement(query, nd->children->next->children->next, e);
}

int ti_do_root_chain(ti_query_t * query, cleri_node_t * nd, ex_t * e)
{
if (!query->collection)
{
ex_set(e, EX_LOOKUP_ERROR,
"the `root` of the `%s` scope is inaccessible; "
"you might want to query a `@collection` scope?",
ti_query_scope_name(query));
return e->nr;
}

/* Set the collection at the current value */
query->rval = (ti_val_t *) query->collection->root;
ti_incref(query->rval);

return do__chain(query, nd->children->next, e);
}

int ti_do_expression(ti_query_t * query, cleri_node_t * nd, ex_t * e)
{
int preopr = (int) ((intptr_t) nd->children->data);
Expand Down
3 changes: 3 additions & 0 deletions src/ti/qbind.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,9 @@ static inline void qbind__expression(ti_qbind_t * qbind, cleri_node_t * nd)
*/
switch (node->next->cl_obj->gid)
{
case CLERI_GID_CHAIN:
nd->data = ti_do_root_chain;
break;
case CLERI_GID_T_ANO:
nd->data = ti_do_ano;
break;
Expand Down