Name resolution bug #619
Replies: 6 comments
-
Posted at 2016-09-07 by @allObjects What about line 9 reading But in deed, in a 'regular' js environment it works as expected... @gordon? ...I guess the context where Espruino tries to resolve the variable is in the function's properties rather than in the function body's scope, of which arguments is a part of... and arguments is messed up too...
produces this console output:
I hoped that at least arguments wasn't messed up... but may be these things are all very and intrinsicly intertwined... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-07 by luwar The sample code above is the result of a two-step transpilation (TypeScript, Google Closure with advanced minification): mod.ts → mod.js → mod.min.js. The original TypeScript code is
I can remove the "static" keyword but it wouldn't be 100% semantically correct because there could be more instances of SHT1x and the checksum method does not need any instance variables. Nevertheless it's a good workaround. Otherwise it would be good to know the origin of the problem. So the current Espruino rule to work around the bug is: Don't use class methods at all? I have to check other modules I contributed: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-07 by @gfwilliams Wow, that's an odd one. I don't have time to sort this now but I have filed a bug: espruino/Espruino#913 Hopefully I'll get that fixed today |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-07 by @gfwilliams Ok, it's more painful than I expected. See the issue above for some notes. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-08 by @gfwilliams Fixed now - not ideal, but it seems to work well enough and to be least likely to break anything else. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-08 by luwar Thank you for the quick solution. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-07 by luwar
The following module code throws an exception:
The code is a snippet from a larger module which must be minified because of its size. I cannot rename the method oder variable because the names come from a minification step with name mangling. The transpiler always starts in every new scope with a, b, c, .
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions