JS backend: fix order call super constructor
This commit is contained in:
@@ -36,6 +36,10 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest {
|
|||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBaseCallOrder() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
|
|
||||||
public void testCrazyInheritance() throws Exception {
|
public void testCrazyInheritance() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ public final class ClassInitializerTranslator extends AbstractTranslator {
|
|||||||
JsInvocation call = new JsInvocation(Namer.getFunctionCallRef(Namer.superMethodNameRef(ref)));
|
JsInvocation call = new JsInvocation(Namer.getFunctionCallRef(Namer.superMethodNameRef(ref)));
|
||||||
call.getArguments().add(JsLiteral.THIS);
|
call.getArguments().add(JsLiteral.THIS);
|
||||||
call.getArguments().addAll(arguments);
|
call.getArguments().addAll(arguments);
|
||||||
initializerStatements.add(call.makeStmt());
|
initializerStatements.add(0, call.makeStmt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
var x = false
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
{
|
||||||
|
x = (this as B).a != 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B(val a: Int = 3) : A() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
B()
|
||||||
|
if (!x) return "fail"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user