Skip to content
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

New transforms option doesn’t instantiate transform #1813

Closed
surma opened this issue Apr 18, 2021 · 2 comments · Fixed by #1814
Closed

New transforms option doesn’t instantiate transform #1813

surma opened this issue Apr 18, 2021 · 2 comments · Fixed by #1814

Comments

@surma
Copy link
Contributor

surma commented Apr 18, 2021

In #1786, y’all kindly added a new transform options to the cli’s main() because of our discussion in torch2424/as-bind#75. However, I didn’t realize that the new code path doesn’t actually instantiate the transform or fixes up the prototype.

Transforms passed via --transform get this code path:

assemblyscript/cli/asc.js

Lines 519 to 529 in 7d0690d

Object.assign(classOrModule.prototype, {
program,
baseDir,
stdout,
stderr,
log: console.error,
readFile,
writeFile,
listFiles
});
transforms.push(new classOrModule());

while the new main() parameter gets:

transforms.push(...options.transforms);

I think it’d be great if both ways to pass in transforms get the same fix-ups applied.

@MaxGraey
Copy link
Member

Thanks for report. If you know for better fix this then PR is welcome!

@surma
Copy link
Contributor Author

surma commented Apr 18, 2021

Created PR #1814 :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants