use of org.eclipse.ceylon.compiler.typechecker.tree.Tree.AttributeDeclaration in project ceylon by eclipse.
the class GenerateJsVisitor method getDefaultExpression.
/**
* Get the specifier expression for a Parameter, if one is available.
*/
SpecifierOrInitializerExpression getDefaultExpression(final Tree.Parameter param) {
final SpecifierOrInitializerExpression expr;
if (param instanceof Tree.ParameterDeclaration || param instanceof Tree.InitializerParameter) {
Tree.MethodDeclaration md = null;
if (param instanceof Tree.ParameterDeclaration) {
Tree.TypedDeclaration td = ((Tree.ParameterDeclaration) param).getTypedDeclaration();
if (td instanceof AttributeDeclaration) {
expr = ((Tree.AttributeDeclaration) td).getSpecifierOrInitializerExpression();
} else if (td instanceof Tree.MethodDeclaration) {
md = (Tree.MethodDeclaration) td;
expr = md.getSpecifierExpression();
} else {
param.addUnexpectedError("Don't know what to do with TypedDeclaration " + td.getClass().getName(), Backend.JavaScript);
expr = null;
}
} else {
expr = ((Tree.InitializerParameter) param).getSpecifierExpression();
}
} else {
param.addUnexpectedError("Don't know what to do with defaulted/sequenced param " + param, Backend.JavaScript);
expr = null;
}
return expr;
}
Aggregations