Skip to content

ASify #1129

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

Merged
merged 29 commits into from
Mar 3, 2020
Merged

ASify #1129

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
42ddc99
Warn on usize mismatch between 32/64 bits
dcodeIO Feb 27, 2020
fbc9144
Add temporary fillers for Map/Set#keys/values
dcodeIO Feb 27, 2020
1aa5616
fix identifier handling, don't use abstract
dcodeIO Feb 27, 2020
ddefdf0
move .kind initializers
dcodeIO Feb 28, 2020
74abb84
fix reported sourcePath of portable d.ts
dcodeIO Feb 28, 2020
fb623c6
fixed 145 compile errors, down to 894
dcodeIO Feb 28, 2020
eace4ad
refactor hell part 1, down to 696
dcodeIO Feb 28, 2020
d5b01d8
refactor hell part 2, down to 291
dcodeIO Feb 29, 2020
9ea312a
refactor hell part 3, down to 197
dcodeIO Feb 29, 2020
f264930
Merge branch 'master' into ASify
dcodeIO Feb 29, 2020
e904e25
refactor hell part 4, down to 29
dcodeIO Feb 29, 2020
38016d6
refactor hell part 5, down to 10
dcodeIO Mar 1, 2020
a56162a
monkey-patch, down to 0
dcodeIO Mar 1, 2020
297671d
proper missing enum module exports fix
dcodeIO Mar 1, 2020
ae30958
add self-test to CI
dcodeIO Mar 1, 2020
a85dbeb
remove parseFloat import / use strtod
dcodeIO Mar 1, 2020
ecd04c6
fix binaryen binding, initial instantiate test
dcodeIO Mar 1, 2020
ae7e28e
boostrap eh
dcodeIO Mar 1, 2020
2e874ed
fix resolving super
dcodeIO Mar 1, 2020
7b4ea55
warn on virtual calls, make a working d.ts
dcodeIO Mar 1, 2020
7d795a0
lint
dcodeIO Mar 1, 2020
246f324
go home npm, you're drunk
dcodeIO Mar 1, 2020
fb62154
cheers
dcodeIO Mar 1, 2020
642c390
fix rogue diagnostic on varargs calls
dcodeIO Mar 2, 2020
44568f9
remaining builtin comments
dcodeIO Mar 2, 2020
94581f0
fix #1138
dcodeIO Mar 2, 2020
3a23ba8
fix #1140
dcodeIO Mar 2, 2020
b5b0d76
abstract stubs, cleanup
dcodeIO Mar 3, 2020
febf1ef
address review comments
dcodeIO Mar 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,20 @@ jobs:
cd lib/loader
npm run asbuild
npm run test
test-bootstrap:
name: "Test self-compilation on node: node"
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/[email protected]
- uses: dcodeIO/[email protected]
with:
node-version: node
- name: Install dependencies
run: npm ci --no-audit
- name: Clean distribution files
run: npm run clean
- name: Test self-compilation
run: |
npm run asbuild
npm run astest
21 changes: 13 additions & 8 deletions cli/asc.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ exports.main = function main(argv, options, callback) {
if ((sourceText = readFile(sourcePath = internalPath + ".ts", baseDir)) == null) {
if ((sourceText = readFile(sourcePath = internalPath + "/index.ts", baseDir)) == null) {
// portable d.ts: uses the .js file next to it in JS or becomes an import in Wasm
sourceText = readFile(sourcePath = internalPath + ".d.ts", baseDir);
sourcePath = internalPath + ".ts";
sourceText = readFile(internalPath + ".d.ts", baseDir);
}
}

Expand Down Expand Up @@ -478,13 +479,16 @@ exports.main = function main(argv, options, callback) {
var internalPath;
while ((internalPath = assemblyscript.nextFile(program)) != null) {
let file = getFile(internalPath, assemblyscript.getDependee(program, internalPath));
if (!file) return callback(Error("Import file '" + internalPath + ".ts' not found."))
if (!file) return callback(Error("Import '" + internalPath + "' not found."))
stats.parseCount++;
stats.parseTime += measure(() => {
assemblyscript.parse(program, file.sourceText, file.sourcePath, false);
});
}
if (checkDiagnostics(program, stderr)) return callback(Error("Parse error"));
var numErrors = checkDiagnostics(program, stderr);
if (numErrors) {
return callback(Error(numErrors + " parse error(s)"));
}
}

// Include runtime template before entry files so its setup runs first
Expand Down Expand Up @@ -579,9 +583,10 @@ exports.main = function main(argv, options, callback) {
} catch (e) {
return callback(e);
}
if (checkDiagnostics(program, stderr)) {
var numErrors = checkDiagnostics(program, stderr);
if (numErrors) {
if (module) module.dispose();
return callback(Error("Compile error"));
return callback(Error(numErrors + " compile error(s)"));
}

// Call afterCompile transform hook
Expand Down Expand Up @@ -1023,17 +1028,17 @@ exports.main = function main(argv, options, callback) {
/** Checks diagnostics emitted so far for errors. */
function checkDiagnostics(program, stderr) {
var diagnostic;
var hasErrors = false;
var numErrors = 0;
while ((diagnostic = assemblyscript.nextDiagnostic(program)) != null) {
if (stderr) {
stderr.write(
assemblyscript.formatDiagnostic(diagnostic, stderr.isTTY, true) +
EOL + EOL
);
}
if (assemblyscript.isError(diagnostic)) hasErrors = true;
if (assemblyscript.isError(diagnostic)) ++numErrors;
}
return hasErrors;
return numErrors;
}

exports.checkDiagnostics = checkDiagnostics;
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
"all": "npm run check && npm run make",
"docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md",
"prepublishOnly": "node scripts/prepublish",
"postpublish": "node scripts/postpublish"
"postpublish": "node scripts/postpublish",
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
"asbuild:untouched": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.untouched.wat -b out/assemblyscript.untouched.wasm -d out/assemblyscript.d.ts --validate --debug --measure",
"asbuild:optimized": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.optimized.wat -b out/assemblyscript.optimized.wasm -O3 --validate --measure",
"astest": "ts-node tests/bootstrap"
},
"releaseFiles": [
"lib/rtrace/index.d.ts",
Expand Down
Loading