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
function Test() {
console.log("Hello");
}
Test.prototype.foo = function() {
console.log("Hello 2");
};
a = new Test();
delete Test; // we've now lost the original 'Test'
dump();
// outputs just:
// var a = Object.create(a.__proto__.constructor["prototype"]);
then...
A = Object.getPrototypeOf(a).constructor;
dump();
// outputs:
// var a = Object.create(a.__proto__.constructor["prototype"]);
// function A() {console.log("Hello");}
// A.prototype.foo = function () {console.log("Hello 2");};
First off, it's doing a depth first rather than breadth-first search for the class to use, which reconstructs stuff really badly.
Then a actually ends up referencing itself in the first instance - Espruino should detect this and instead create a new temporary Class name to output first.
It'd actually be neat if dump() could take an argument which is the variable to 'start' from - it'd allow you to (for instance) dump just a single class.
It has to be aware of scope/proto elements and JSV_PARENTINFO so that it can rebuild code snippets that contain heavier Object orientation.
The text was updated successfully, but these errors were encountered: