private String nameOf(final AstNode node) {
if (node instanceof Name) {
return ((Name) node).getIdentifier();
}
else if (node instanceof PropertyGet) {
PropertyGet prop = (PropertyGet) node;
return String.format("%s.%s", nameOf(prop.getTarget()), nameOf(prop.getProperty()));
}
else if (node instanceof StringLiteral) {
return ((StringLiteral) node).getValue();
}
return null;