mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 18:34:03 +03:00
fix double-eval of this arguments (#700)
This commit is contained in:
parent
d03a5a9dde
commit
1254920482
@ -167,6 +167,7 @@ public abstract class InvokeCallableNode extends BaseNode {
|
||||
Stateful selfResult = thisExecutor.executeThunk((Thunk) selfArgument, state);
|
||||
selfArgument = selfResult.getValue();
|
||||
state = selfResult.getState();
|
||||
arguments[thisArgumentPosition] = selfArgument;
|
||||
}
|
||||
Function function = methodResolverNode.execute(symbol, selfArgument);
|
||||
return this.invokeFunctionNode.execute(function, callerFrame, state, arguments);
|
||||
|
@ -13,6 +13,17 @@ class MethodsTest extends InterpreterTest {
|
||||
eval(code) shouldEqual 11
|
||||
}
|
||||
|
||||
"Method calls" should "execute `this` argument once" in {
|
||||
val code =
|
||||
"""
|
||||
|Unit.foo = 0
|
||||
|
|
||||
|main = (IO.println "foo").foo
|
||||
|""".stripMargin
|
||||
eval(code)
|
||||
consumeOut shouldEqual List("foo")
|
||||
}
|
||||
|
||||
"Methods" should "be callable with dot operator" in {
|
||||
val code =
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user