path FEATURE new compiled path structure (#1108)

Refactoring includes using it for
instance-identifier and for checking leafref,
it is evaluated using stanrad XPath. Predicates
used for lyd_new_list2(), tests included.
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index ee5b870..c4370b6 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -173,7 +173,8 @@
                                      defined, but its content instances are supposed to be placed into
                                      the target module (mod) */
     struct ly_set groupings;    /**< stack for groupings circular check */
-    struct ly_set unres;        /**< to validate leafref's target and xpath of when/must */
+    struct ly_set xpath;        /**< to validate leafref's targets */
+    struct ly_set leafrefs;     /**< when/must to check */
     struct ly_set dflts;        /**< set of incomplete default values */
     struct ly_set tpdf_chain;
     uint16_t path_len;
@@ -697,17 +698,6 @@
 LY_ERR lys_compile_type_pattern_check(struct ly_ctx *ctx, const char *log_path, const char *pattern, pcre2_code **code);
 
 /**
- * @brief Validate the leafref path.
- * @param[in] ctx Compile context
- * @param[in] startnode Path context node (where the leafref path begins/is placed).
- * @param[in] leafref Leafref to validate.
- * @param[out] target Optional resolved leafref target.
- * @return LY_ERR value - LY_SUCCESS or LY_EVALID.
- */
-LY_ERR lys_compile_leafref_validate(struct lysc_ctx *ctx, struct lysc_node *startnode, struct lysc_type_leafref *leafref,
-                                    const struct lysc_node **target);
-
-/**
  * @brief Macro to free [sized array](@ref sizedarrays) of items using the provided free function. The ARRAY itself is also freed,
  * but the memory is not sanitized.
  */