Skip to content

Commit b1c6cca

Browse files
committed
Use long.js in JS and native i64 in WASM; Compile literals more thoroughly
1 parent 874f87f commit b1c6cca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1754
-2200
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
**AssemblyScript** compiles strictly typed [TypeScript](http://www.typescriptlang.org) to [WebAssembly](http://webassembly.org) using [Binaryen](https://github.com/WebAssembly/binaryen). It generates minimal WebAssembly modules while being just an `npm install` away.
77

8-
See [the AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) for further instructions and documentation. You can also try it out in [Web Assembly Studio](https://webassembly.studio)!
8+
See [the AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) for further instructions and documentation. You can also try it out in [WebAssembly Studio](https://webassembly.studio)!
99

1010
Examples
1111
--------

bin/asc.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ exports.main = function main(argv, options, callback) {
353353
else if (args.shrinkLevel === "z")
354354
shrinkLevel = 2;
355355

356-
module.setOptimizeLevel(optimizeLevel);
356+
module.setOptimizeLevel(optimizeLevel > 0 ? optimizeLevel : 0);
357357
module.setShrinkLevel(shrinkLevel);
358358
module.setDebugInfo(debugInfo);
359359

@@ -371,7 +371,9 @@ exports.main = function main(argv, options, callback) {
371371
// Optimize the module if requested
372372
if (optimizeLevel >= 0) {
373373
stats.optimizeCount++;
374-
stats.optimizeTime += measure(() => module.optimize());
374+
stats.optimizeTime += measure(() => {
375+
module.optimize();
376+
});
375377
}
376378

377379
// Run additional passes if requested
@@ -405,7 +407,9 @@ exports.main = function main(argv, options, callback) {
405407

406408
let binary;
407409
stats.emitCount++;
408-
stats.emitTime += measure(() => binary = module.toBinary(sourceMapURL));
410+
stats.emitTime += measure(() => {
411+
binary = module.toBinary(sourceMapURL)
412+
});
409413

410414
if (args.binaryFile.length) {
411415
writeFile(path.join(baseDir, args.binaryFile), binary.output);
@@ -458,11 +462,15 @@ exports.main = function main(argv, options, callback) {
458462
let text;
459463
if (args.textFile && args.textFile.length) {
460464
stats.emitCount++;
461-
stats.emitTime += measure(() => text = module.toText());
465+
stats.emitTime += measure(() => {
466+
text = module.toText();
467+
});
462468
writeFile(path.join(baseDir, args.textFile), text);
463469
} else if (!hasStdout) {
464470
stats.emitCount++;
465-
stats.emitTime += measure(() => text = module.toText());
471+
stats.emitTime += measure(() => {
472+
text = module.toText()
473+
});
466474
writeStdout(text);
467475
hasStdout = true;
468476
}
@@ -473,11 +481,15 @@ exports.main = function main(argv, options, callback) {
473481
let asm;
474482
if (args.asmjsFile.length) {
475483
stats.emitCount++;
476-
stats.emitTime += measure(() => asm = module.toAsmjs());
484+
stats.emitTime += measure(() => {
485+
asm = module.toAsmjs();
486+
});
477487
writeFile(path.join(baseDir, args.asmjsFile), asm);
478488
} else if (!hasStdout) {
479489
stats.emitCount++;
480-
stats.emitTime += measure(() => asm = module.toAsmjs());
490+
stats.emitTime += measure(() => {
491+
asm = module.toAsmjs();
492+
});
481493
writeStdout(asm);
482494
hasStdout = true;
483495
}

dist/asc.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 34 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
1212
},
1313
"dependencies": {
14-
"binaryen": "42.0.0-nightly.20180208",
14+
"@types/long": "^3.0.32",
15+
"binaryen": "42.0.0-nightly.20180213",
1516
"glob": "^7.1.2",
17+
"long": "^4.0.0",
1618
"minimist": "^1.2.0",
1719
"ts-node": "^4.1.0"
1820
},
1921
"devDependencies": {
2022
"babel-minify-webpack-plugin": "^0.3.0",
2123
"browser-process-hrtime": "^0.1.2",
22-
"chalk": "^2.3.0",
24+
"chalk": "^2.3.1",
2325
"diff": "^3.4.0",
24-
"long": "^4.0.0",
2526
"source-map-support": "^0.5.3",
2627
"ts-loader": "^3.5.0",
2728
"tslint": "^5.9.1",

src/ast.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import {
1010
Range
1111
} from "./tokenizer";
1212

13-
import {
14-
I64
15-
} from "./util/i64";
16-
1713
import {
1814
normalize as normalizePath,
1915
resolve as resolvePath

0 commit comments

Comments
 (0)