use of net.jangaroo.jooc.ast.ParenthesizedExpr in project jangaroo-tools by CoreMedia.
the class JsCodeGenerator method generateSuperConstructorCallCode.
private void generateSuperConstructorCallCode(ClassDeclaration classDeclaration, ParenthesizedExpr<CommaSeparatedList<Expr>> args) throws IOException {
String superClassQName = classDeclaration.getSuperTypeDeclaration().getQualifiedNameStr();
if ("Error".equals(superClassQName)) {
// built-in Error constructor called as function unfortunately always creates a new Error object, so we have to use emulation provided by Jangaroo Runtime:
out.write("joo.Error");
} else {
Ide superClassIde = classDeclaration.getSuperType().getIde();
out.writeSymbolWhitespace(superClassIde.getSymbol());
IdeDeclaration superClassDeclaration = superClassIde.getDeclaration();
String packageName = superClassDeclaration.getPackageDeclaration().getQualifiedNameStr();
String qName = superClassDeclaration.getName();
if (packageName.length() > 0) {
String packageAuxVar = compilationUnit.getAuxVarForPackage(packageName);
qName = CompilerUtils.qName(packageAuxVar, qName);
}
out.write(qName);
}
out.writeToken(".call");
if (args == null) {
out.writeToken("(this)");
} else {
out.writeSymbol(args.getLParen());
out.writeToken("this");
CommaSeparatedList<Expr> arguments = args.getExpr();
if (arguments != null) {
if (arguments.getHead() != null) {
out.writeToken(",");
}
arguments.visit(this);
}
out.writeSymbol(args.getRParen());
}
}
Aggregations