Minor in JS backend: added comment for InvokeIntrinsic::bothReceivers.

This commit is contained in:
Zalim Bashorov
2014-08-26 12:29:46 +04:00
parent a735d67e86
commit 0fd1b5152a
@@ -159,6 +159,20 @@ object InvokeIntrinsic : FunctionCallCase {
override fun FunctionCallInfo.thisObject(): JsExpression {
return JsInvocation(thisObject, argumentsInfo.getTranslateArguments())
}
/**
* A call of extension lambda in compiler looks like as call of invoke function of some ExtensionFunctionN instance.
* So that call have both receivers -- some ExtensionFunctionN instance as this and receiverObject as receiver.
*
* in Kotlin code:
* obj.extLambda(some, args)
*
* in compiler:
* (this: extLambda, receiver: obj).invoke(some, args)
*
* in result JS:
* extLambda.call(obj, some, args)
*/
override fun FunctionCallInfo.bothReceivers(): JsExpression {
return JsInvocation(Namer.getFunctionCallRef(thisObject!!), addReceiverToArgs(receiverObject!!, argumentsInfo.getTranslateArguments()))
}