New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scopes of const/let in 2v13.122 #2215
Comments
Further experiments show additional variables need changes for full functionality (including Gadgetbridge message parsing). This is just a workaround, I assume correct solution would be fixing the scope handling. |
Do you think you could give me some short example code of what's not working that should be? |
This is very likely related to #2207 and http://forum.espruino.com/conversations/376541/ |
I have done some experiments and found a relatively small example which seems to show this problem: Upload this as
The following snippets can then be run from RAM:
Only
The following is strange to me, this also works:
|
Adding the example as cached module does not reproduce the problem:
|
Thanks - well this is all pretty strange! More stuff... This breaks:
And it'd seem that
The issue seems to be that in those cases the const/let are being created in the wrong scope (probably the same one as the first const) - but now I have a self-contained test I should be able to fix it pretty quick - thanks for the help! |
The weather widget exhibits an
weather.wid.js ReferenceError: ReferenceError: "storage" is not defined
error with this firmware version. Changing the globally scopedstorage
var in the lib.js fromconst
tovar
fixes this. To get the widget to working without errors, there also needs to be a change fromlet
tovar
for theexpiryTimeout
variable.It seems the access from functions to globally defined const/var variables does not yet work correctly.
The text was updated successfully, but these errors were encountered: