safeName property
String
get
safeName
Safely extracts the name of an AST node.
Implementation
String get safeName {
if (this is ClassDeclaration) {
return (this as ClassDeclaration).namePart.toString();
} else if (this is MethodDeclaration) {
return (this as MethodDeclaration).name.lexeme;
} else if (this is FunctionDeclaration) {
return (this as FunctionDeclaration).name.lexeme;
} else if (this is VariableDeclaration) {
return (this as VariableDeclaration).name.lexeme;
}
return toString().split(' ').first;
}