schema tree FEATURE allow changing enabled features

At the cost of recompiling the whole context.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 398e3a1..3d56842 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -669,14 +669,25 @@
 API LY_ERR
 lys_set_implemented(struct lys_module *mod, const char **features)
 {
-    LY_ERR ret = LY_SUCCESS;
+    LY_ERR ret = LY_SUCCESS, r;
     struct lys_module *m;
     uint32_t i, idx;
 
     LY_CHECK_ARG_RET(NULL, mod, LY_EINVAL);
 
     if (mod->implemented) {
-        /* mod is already implemented */
+        /* mod is already implemented, set the features */
+        r = lys_set_features(mod->parsed, features);
+        if (r == LY_EEXIST) {
+            /* no changes */
+            return LY_SUCCESS;
+        } else if (r) {
+            /* error */
+            return r;
+        }
+
+        /* full recompilation */
+        lys_recompile(mod->ctx, NULL);
         return LY_SUCCESS;
     }
 
@@ -725,6 +736,7 @@
 
         ly_set_erase(&mod->ctx->implementing, NULL);
     }
+
     return ret;
 }