leafo/moonscript — Issue #24: Unexpected method translation in a with statement
Author: dcharbon
Created: 2011-11-01 22:23:46+00:00
State: open

The unexpected behavior is demonstrated here: http://moonscript.org/compiler/#a

In a with statement, if you leave the parenthesis off after a method call to a nested object, the method is invoked on the "with" object, rather than the indicated target. So:
with foo
.prop\send msg

Becomes:
do
local _with_0 = self.foo
_with_0.prop(_with_0:send(msg))
return _with_0
end

But,
with foo
.prop\send(msg)

Becomes:
do
local _with_0 = self.foo
_with_0.prop:send(msg)
return _with_0
end