Progress; Restructuring

This commit is contained in:
dcodeIO
2017-10-02 12:52:15 +02:00
parent e14d02e040
commit f55fc70220
20 changed files with 1008 additions and 887 deletions

View File

@ -3,10 +3,10 @@ import { Compiler } from "../src/compiler";
import { Parser } from "../src/parser";
const files: Map<string,string> = new Map([
["main", `import { Test } from "./a"; export { TestAlias } from "./d";`],
["main", `import { Test as TestAlias } from "./a"; export { TestAlias } from "./d"; if (1) {} export const a: i32 = 123;`],
["a", `export { Test } from "./b";`],
["b", `export { Test } from "./c";`],
["c", `export enum Test { ONE = 1 }`],
["c", `export enum Test { ONE = 1, TWO = 2 }`],
["d", `export { Test as TestAlias } from "./b";`]
]);
@ -24,14 +24,14 @@ const program = parser.finish();
const compiler = new Compiler(program);
const module = compiler.compile();
console.log("names", program.names);
console.log("exports", program.exports);
console.log("names", program.names.keys());
console.log("exports", program.exports.keys());
// module.optimize();
// module.validate(); // global initializers can't use i32.add etc. yet
/* _BinaryenModulePrint(module.ref);
_BinaryenModulePrint(module.ref);
console.log("--- statements ---");
/* console.log("--- statements ---");
compiler.statements.forEach(stmt => {
_BinaryenExpressionPrint(stmt);
}); */