Fix ClassBuilder's getConstructor() when super class is extern

Handle super class constructor's expr being `null`, which happens
when the super class is an extern with a constructor definition.
This commit is contained in:
k
2018-05-08 16:23:12 +02:00
parent 55a4b1463f
commit f65df0e94b

View File

@@ -63,7 +63,9 @@ class ClassBuilder {
if (cl.constructor != null) {
try {
var ctor = cl.constructor.get();
var func = Context.getTypedExpr(ctor.expr()).getFunction().sure();
var ctorExpr = ctor.expr();
if (ctorExpr == null) throw 'Super constructor has no expression';
var func = Context.getTypedExpr(ctorExpr).getFunction().sure();
for (arg in func.args) //this is to deal with type parameter substitutions
arg.type = null;
@@ -196,4 +198,4 @@ class ClassBuilder {
p(builder);
return builder.export(verbose);
}
}
}