schema compile REFACTOR recompile using explicit compilation
... and leave it up to calling functions.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index d1392e5..01efc11 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -809,32 +809,17 @@
if (r == LY_EEXIST) {
/* no changes */
return LY_SUCCESS;
- } else if (r) {
- /* error */
- return r;
- }
-
- if (mod->ctx->flags & LY_CTX_EXPLICIT_COMPILE) {
- /* just mark the module as changed */
+ } else if (!r) {
+ /* mark the module as changed */
mod->to_compile = 1;
- return LY_SUCCESS;
- } else {
- /* full recompilation */
- return lys_recompile(mod->ctx);
}
+
+ return r;
}
- /* implement */
- ret = lys_implement(mod, features, unres);
- if (ret == LY_ERECOMPILE) {
- /* recompile */
- LY_CHECK_GOTO(ret = lys_recompile(mod->ctx), cleanup);
-
- /* reset unres, it is no longer valid after recompilation, which has actually resolved it all */
- lys_compile_unres_glob_erase(mod->ctx, unres, 1);
- } else if (ret) {
- goto cleanup;
- }
+ /* implement, ignore recompilation because it must always take place later */
+ r = lys_implement(mod, features, unres);
+ LY_CHECK_ERR_GOTO(r && (r != LY_ERECOMPILE), ret = r, cleanup);
if (mod->ctx->flags & LY_CTX_ALL_IMPLEMENTED) {
/* implement all the imports as well */
@@ -844,9 +829,8 @@
continue;
}
- ret = lys_implement(mod, NULL, unres);
- if (ret == LY_ERECOMPILE) {
- LY_CHECK_GOTO(ret = lys_recompile(mod->ctx), cleanup);
+ r = lys_implement(mod, NULL, unres);
+ LY_CHECK_ERR_GOTO(r && (r != LY_ERECOMPILE), ret = r, cleanup);
lys_compile_unres_glob_erase(mod->ctx, unres, 1);
} else if (ret) {