@Test(expected = IllegalArgumentException.class) public void test_are_leafs_with_other_than_leaf() throws Exception { JavaScriptTree tree1 = parse("true;", Tree.Kind.SCRIPT); assertThat(SyntacticEquivalence.areLeafsEquivalent(tree1, tree1)).isTrue(); }
@VisibleForTesting protected static boolean areLeafsEquivalent(JavaScriptTree leftNode, JavaScriptTree rightNode) { if (leftNode instanceof IdentifierTree) { return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name()); } else if (leftNode instanceof SyntaxToken) { return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text()); } else { throw new IllegalArgumentException(); } }
SyntacticEquivalence { @VisibleForTesting protected static boolean areLeafsEquivalent(JavaScriptTree leftNode, JavaScriptTree rightNode) { if (leftNode instanceof IdentifierTree) { return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name()); } else if (leftNode instanceof SyntaxToken) { return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text()); } else { throw new IllegalArgumentException(); } } }
SyntacticEquivalence { @VisibleForTesting protected static boolean areLeafsEquivalent(JavaScriptTree leftNode, JavaScriptTree rightNode) { if (leftNode instanceof IdentifierTree) { return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name()); } else if (leftNode instanceof SyntaxToken) { return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text()); } else { throw new IllegalArgumentException(); } } private  SyntacticEquivalence(); }
SyntacticEquivalence { @VisibleForTesting protected static boolean areLeafsEquivalent(JavaScriptTree leftNode, JavaScriptTree rightNode) { if (leftNode instanceof IdentifierTree) { return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name()); } else if (leftNode instanceof SyntaxToken) { return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text()); } else { throw new IllegalArgumentException(); } } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode); }
SyntacticEquivalence { @VisibleForTesting protected static boolean areLeafsEquivalent(JavaScriptTree leftNode, JavaScriptTree rightNode) { if (leftNode instanceof IdentifierTree) { return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name()); } else if (leftNode instanceof SyntaxToken) { return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text()); } else { throw new IllegalArgumentException(); } } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode);  }