Skip to content

New transforms option doesn’t instantiate transform #1813

Closed
@surma

Description

@surma

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions