forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmytransform.ts
More file actions
18 lines (16 loc) · 719 Bytes
/
mytransform.ts
File metadata and controls
18 lines (16 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Transform } from "../../cli/transform"; // "assemblyscript/cli/transform"
import { Parser, Module, SourceKind } from "../.."; // "assemblyscript"
import * as binaryen from "binaryen";
class MyTransform extends Transform {
afterParse(parser: Parser): void {
this.log("[mytransform.ts] afterParse called, baseDir = " + this.baseDir);
var sources = parser.program.sources;
sources.forEach(source => this.log(" " + source.internalPath + " [" + SourceKind[source.sourceKind] + "]"));
}
afterCompile(asModule: Module): void {
this.log("[mytransform.ts] afterCompile called");
var module = binaryen.wrapModule(asModule.ref);
this.log(module.emitBinary());
}
}
export = MyTransform;