Open yannis218 opened 6 years ago
So the difference in the compiled code is:
var obj1$ = this;
return (true ? obj1$.Item$obj1$c_make : obj1$.Item$obj1$c_make)(); //bad
Vs:
var obj1$ = this;
return (true ? ($4 = ($5 = obj1()), m$1.f3$($4, $4.Item$obj1$c_make)) :
($6 = ($7 = obj1()), m$1.f3$($6, $6.Item$obj1$c_make)))(); //OK
So it appears to be some sort of scoping problem where this
doesn't refer to quite the right thing.
Note that the bug only affects expressions like Item.make
. It does not occur forthis.Item.make
.
I guess it's because there is no new
anywhere, so this
is pointing to the wrong thing.
The problem is in FunctionHelper.generateCallable()
, I'm just trying to coax it into generating the right code.
I've fixed this, I believe, but still need to add a test.
I am experimenting with Ceylon and have produced some code that compiles OK but produces a runtime error. I am using Ceylon 1.3.3, Eclipse (Oxygen.3a). I am compiling into Javascript, which I am running in Waterfox 56.2.3 (64-bit) via an HTML file that does:
The code (trimmed down and abbreviated) is:
The runtime error I get is:
The error does not occur if I change the code to:
or of course:
Surely the code should either work or not compile.