-
-
Notifications
You must be signed in to change notification settings - Fork 669
Fixed demangles an assemblyscript module #363
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
Conversation
These look like good changes to me. Going to break code that uses explicit |
LGTM |
lib/loader/index.js
Outdated
@@ -265,6 +265,7 @@ function demangle(exports, baseModule) { | |||
let classElem = curr[className]; | |||
if (typeof classElem === "undefined" || !classElem.prototype) { | |||
let ctor = function(...args) { | |||
args.unshift(null); // pass null pointer for class constructor of AssemblyScript | |||
return ctor.wrap(ctor.prototype.constructor(...args)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be a bit more efficient to write as return ctor.wrap(ctor.prototype.constructor(0, ...args));
I think
lib/loader/index.js
Outdated
value: function (...args) { | ||
args.unshift(this.this); | ||
setargc(args.length); | ||
return elem(...args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar: return elem(this.this, ...args);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcodeIO this.this
looks strange. May be better rename it to self
or value
for object's value in wrap
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only used .this
as the property name because is is less likely to conflict with a class's own fields and methods. Could still conflict, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. What about using Symbol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, done in 86c084a
done! |
@dcodeIO Thanks! :) |
No description provided.