package graphql.validation;


import graphql.language.Node;

import java.util.ArrayList;
import java.util.List;

public class LanguageTraversal {

    private final List<Node> path;

    public LanguageTraversal() {
        path = new ArrayList<>();
    }

    public LanguageTraversal(List<Node> basePath) {
        if (basePath != null) {
            path = basePath;
        } else {
            path = new ArrayList<>();
        }
    }

    public void traverse(Node root, DocumentVisitor documentVisitor) {
        traverseImpl(root, documentVisitor, path);
    }


    private void traverseImpl(Node root, DocumentVisitor documentVisitor, List<Node> path) {
        documentVisitor.enter(root, path);
        path.add(root);
        for (Node child : root.getChildren()) {
            traverseImpl(child, documentVisitor, path);
        }
        path.remove(path.size() - 1);
        documentVisitor.leave(root, path);
    }
}

@@ -23,16 +23,41 @@
 tion;%0A%0A%0A
+import graphql.Internal;%0A
 import g
@@ -131,16 +131,26 @@
 .List;%0A%0A
+@Internal%0A
 public c

mark as internal