function queryRecursivelyByPath()

in legacy/js/docTool/schemaHelper.js [231:286]


        function queryRecursivelyByPath(docTree, context, pathIndex) {
            if (!dtLib.isObject(docTree)) {
                return;
            }

            var pathItem = (context.optionPath || context.fuzzyPath)[pathIndex];
            var lastPathItem = (context.optionPath || context.fuzzyPath)[pathIndex - 1];

            if (!pathItem) {
                // Consider: query 'series-line', whether match 'series'?
                if (!docTree.isEnumParent
                    || context.fuzzyPath
                    || !lastPathItem
                    || !lastPathItem.typeEnum
                ) {
                    context.result.push(docTree);
                }

                if (!docTree.isEnumParent) {
                    // Enum children can be matched togather with their parent.
                    return;
                }
            }

            for (var i = 0, len = (docTree.children || []).length; i < len; i++) {
                var child = docTree.children[i];
                var nextPathIndex = null;

                if (docTree.isEnumParent) {
                    if (!lastPathItem
                        || !lastPathItem.typeEnum
                        || child.typeEnum === lastPathItem.typeEnum
                    ) {
                        nextPathIndex = pathIndex;
                    }
                    // else do nothing.
                }
                else if (context.optionPath
                    && pathAccurateMatch(child, pathItem.propertyName, pathItem.arrayName)
                ) {
                    nextPathIndex = pathIndex + 1;
                }
                else if (context.fuzzyPath) {
                    if (pathFuzzyMatch(child, pathItem.propertyName, pathItem.arrayName)) {
                        nextPathIndex = pathIndex + 1;
                    }
                    else {
                        nextPathIndex = pathIndex;
                    }
                }

                if (nextPathIndex != null) {
                    queryRecursivelyByPath(child, context, nextPathIndex);
                }
            }
        }