diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 651a4f38e9d..64f96021da8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,24 +10,13 @@ - + - - - - - - - - - - - - + @@ -176,7 +165,7 @@ - + - - - - - - - - - @@ -328,15 +308,26 @@ - + - + + + + + + + + + + + + @@ -395,55 +386,19 @@ - - + + - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -451,8 +406,8 @@ - - + + @@ -460,8 +415,8 @@ - - + + @@ -469,8 +424,8 @@ - - + + @@ -478,6 +433,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -512,11 +503,6 @@ @@ -784,11 +775,69 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -1052,6 +1050,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1419,66 +1477,47 @@ - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - + - + - - + + + + @@ -1489,50 +1528,73 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java b/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java index f0973d2906e..2605dbdd24e 100644 --- a/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java +++ b/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java @@ -33,6 +33,7 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.*; */ //TODO: write tests on calling backing fields as functions //TODO: constructor receives too many parameters +//TODO: reorder methods properly public final class CallTranslator extends AbstractTranslator { private static final class Builder { @@ -235,17 +236,18 @@ public final class CallTranslator extends AbstractTranslator { @NotNull private JsExpression extensionFunctionLiteralCall() { + receiver = getExtensionFunctionCallReceiver(); + List callArguments = generateExtensionCallArgumentList(); + JsInvocation callMethodInvocation = generateCallMethodInvocation(); + callMethodInvocation.setArguments(callArguments); + return callMethodInvocation; + } - List callArguments = new ArrayList(); - assert receiver != null; - callArguments.add(thisObject()); - callArguments.addAll(arguments); - receiver = null; + private JsInvocation generateCallMethodInvocation() { JsNameRef callMethodNameRef = AstUtil.newQualifiedNameRef("call"); JsInvocation callMethodInvocation = new JsInvocation(); callMethodInvocation.setQualifier(callMethodNameRef); AstUtil.setQualifier(callMethodInvocation, calleeReference()); - callMethodInvocation.setArguments(callArguments); return callMethodInvocation; } @@ -259,8 +261,6 @@ public final class CallTranslator extends AbstractTranslator { private JsExpression extensionFunctionCall() { receiver = getExtensionFunctionCallReceiver(); List argumentList = generateExtensionCallArgumentList(); - //Now the rest of the code can work as if it was simple method invocation - receiver = null; return AstUtil.newInvocation(calleeReference(), argumentList); } @@ -269,6 +269,8 @@ public final class CallTranslator extends AbstractTranslator { List argumentList = new ArrayList(); argumentList.add(receiver); argumentList.addAll(arguments); + //Now the rest of the code can work as if it was simple method invocation + receiver = null; return argumentList; }