Skip to content

Commit

Permalink
add NameLogicTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomassetti committed Jul 23, 2018
1 parent 6211f6e commit ac01fb1
Show file tree
Hide file tree
Showing 3 changed files with 568 additions and 478 deletions.
Expand Up @@ -315,6 +315,19 @@ private static boolean isSyntacticallyAExpressionName(Node name) {
return false; return false;
} }


public static String nameAsString(Node name) {
if (!isAName(name)) {
throw new IllegalArgumentException("A name was expected");
}
if (name instanceof Name) {
return ((Name)name).asString();
} else if (name instanceof SimpleName) {
return ((SimpleName)name).getIdentifier();
} else {
throw new UnsupportedOperationException("Unknown type of name found: " + name);
}
}

private interface PredicateOnParentAndChild<P extends Node, C extends Node> { private interface PredicateOnParentAndChild<P extends Node, C extends Node> {
boolean isSatisfied(P parent, C child); boolean isSatisfied(P parent, C child);
} }
Expand Down

0 comments on commit ac01fb1

Please sign in to comment.