diff --git a/CHANGELOG.md b/CHANGELOG.md index b08deae9..b74e7837 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/inc/ti/do.h b/inc/ti/do.h index cfed6005..e57eaa76 100644 --- a/inc/ti/do.h +++ b/inc/ti/do.h @@ -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); diff --git a/inc/ti/version.h b/inc/ti/version.h index 5f7edf95..bc7c34be 100644 --- a/inc/ti/version.h +++ b/inc/ti/version.h @@ -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 */ @@ -25,7 +25,7 @@ * "-rc0" * "" */ -#define TI_VERSION_PRE_RELEASE "" +#define TI_VERSION_PRE_RELEASE "-alpha0" #define TI_MAINTAINER \ "Jeroen van der Heijden " diff --git a/src/ti/do.c b/src/ti/do.c index 7a880a78..c6a68692 100644 --- a/src/ti/do.c +++ b/src/ti/do.c @@ -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); diff --git a/src/ti/qbind.c b/src/ti/qbind.c index 38845c2d..f3697a19 100644 --- a/src/ti/qbind.c +++ b/src/ti/qbind.c @@ -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;