Uncomment test for KT-921
Minor code improvements
This commit is contained in:
@@ -93,14 +93,18 @@ public class FunctionTest extends AbstractExpressionTest {
|
|||||||
fooBoxTest();
|
fooBoxTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: disabled. Probable cause : vars in closures.
|
public void testKT921() throws Exception {
|
||||||
|
|
||||||
//public void testKT921() throws Exception {
|
checkOutput("KT-921.kt", "1, end\n" +
|
||||||
//
|
"1, 2, end\n" +
|
||||||
// checkOutput("KT-921.kt", "1,\n" +
|
"1, 2, 3, end\n" +
|
||||||
// "1, 2,\n" +
|
"2, 3, end\n" +
|
||||||
// "2, ");
|
"!\n" +
|
||||||
//}
|
"3, end\n" +
|
||||||
|
"!\n" +
|
||||||
|
"end\n" +
|
||||||
|
"!");
|
||||||
|
}
|
||||||
|
|
||||||
public void testFunctionInsideFunction() throws Exception {
|
public void testFunctionInsideFunction() throws Exception {
|
||||||
fooBoxTest();
|
fooBoxTest();
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ public final class ClassInitializerTranslator extends AbstractTranslator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsPropertyInitializer generateInitializeMethod() {
|
public JsPropertyInitializer generateInitializeMethod() {
|
||||||
//TODO: it's inconsistent that we scope for class and function for constructor, currently have problems implementing better way
|
//TODO: it's inconsistent that we have scope for class and function for constructor, currently have problems implementing better way
|
||||||
ConstructorDescriptor primaryConstructor = getConstructor(bindingContext(), classDeclaration);
|
ConstructorDescriptor primaryConstructor = getConstructor(bindingContext(), classDeclaration);
|
||||||
JsFunction result = context().getFunctionObject(primaryConstructor);
|
JsFunction result = context().getFunctionObject(primaryConstructor);
|
||||||
//NOTE: while we translate constructor parameters we also add property initializer statements
|
//NOTE: while we translate constructor parameters we also add property initializer statements
|
||||||
|
|||||||
@@ -56,4 +56,13 @@ public final class CallParameters {
|
|||||||
public JsExpression getReceiver() {
|
public JsExpression getReceiver() {
|
||||||
return receiver;
|
return receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public JsExpression getThisOrReceiverOrNull() {
|
||||||
|
if (thisObject == null) {
|
||||||
|
return receiver;
|
||||||
|
}
|
||||||
|
assert receiver == null;
|
||||||
|
return thisObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public final class CallTranslator extends AbstractTranslator {
|
|||||||
private JsExpression intrinsicInvocation() {
|
private JsExpression intrinsicInvocation() {
|
||||||
assert descriptor instanceof FunctionDescriptor;
|
assert descriptor instanceof FunctionDescriptor;
|
||||||
Intrinsic intrinsic = context().intrinsics().getFunctionIntrinsic((FunctionDescriptor) descriptor);
|
Intrinsic intrinsic = context().intrinsics().getFunctionIntrinsic((FunctionDescriptor) descriptor);
|
||||||
return intrinsic.apply(callParameters.getThisObject(), arguments, context());
|
return intrinsic.apply(callParameters.getThisOrReceiverOrNull(), arguments, context());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConstructor() {
|
private boolean isConstructor() {
|
||||||
@@ -244,7 +244,7 @@ public final class CallTranslator extends AbstractTranslator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
JsExpression getThisObjectOrQualifier() {
|
private JsExpression getThisObjectOrQualifier() {
|
||||||
JsExpression thisObject = callParameters.getThisObject();
|
JsExpression thisObject = callParameters.getThisObject();
|
||||||
if (thisObject != null) {
|
if (thisObject != null) {
|
||||||
return thisObject;
|
return thisObject;
|
||||||
|
|||||||
Reference in New Issue
Block a user