schema compile BUGFIX sooner recompilation

Recompilation needs to be performed right
when it is required for the module that
caused it. So now from the point of trying
to compile a new module that sets the
recompile flag to the glob_unres function
that must have caused it, LY_ERECOMPILE
is passed.

Fixes #1528
diff --git a/src/path.c b/src/path.c
index 6a413a3..0190811 100644
--- a/src/path.c
+++ b/src/path.c
@@ -24,6 +24,7 @@
 #include "compat.h"
 #include "log.h"
 #include "plugins_types.h"
+#include "schema_compile.h"
 #include "set.h"
 #include "tree.h"
 #include "tree_data_internal.h"
@@ -431,6 +432,9 @@
 
             assert(unres);
             LY_CHECK_GOTO(ret = lys_set_implemented_r((struct lys_module *)*mod, NULL, unres), error);
+            if (unres->recompile) {
+                return LY_ERECOMPILE;
+            }
         }
 
         LOG_LOCBACK(cur_node ? 1 : 0, 0, 0, 0);