You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modules.addCached("mod",`
class b {
constructor(a) {
console.log("Argument",a);
if (a!="Foo") throw "No argument passed!";
}
}
exports = b;`);
mB = new (require('mod'))("Foo");
Fails, but
class b {
constructor(a) {
console.log("Argument",a);
if (a!="Foo") throw "No argument passed!";
}
}
mB = new b("Foo");
works, as does:
Modules.addCached("mod",`
function b(a) {
console.log("Argument",a);
if (a!="Foo") throw "No argument passed!";
}
exports = b;`);
mB = new (require('mod'))("Foo");
Ok, comparing traces of the object it seems this is because in a class the scope gets moved to the front of the function (before parameters), when the order actually matters during execution.
Fails, but
works, as does:
http://forum.espruino.com/conversations/329854/#comment14581420
This worked in 2v00
The text was updated successfully, but these errors were encountered: