pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/AssemblyScript/assemblyscript/commit/a3b18e719b8f5766f199bebb6cfc2ba0953d4f98

.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> ASify: Make the compiler compatible with the compiler (#1129) · AssemblyScript/assemblyscript@a3b18e7 · GitHub
Skip to content

Commit a3b18e7

Browse files
authored
ASify: Make the compiler compatible with the compiler (#1129)
1 parent b433bc4 commit a3b18e7

83 files changed

Lines changed: 9513 additions & 5631 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,20 @@ jobs:
141141
cd lib/loader
142142
npm run asbuild
143143
npm run test
144+
test-bootstrap:
145+
name: "Test self-compilation on node: node"
146+
runs-on: ubuntu-latest
147+
needs: check
148+
steps:
149+
- uses: actions/checkout@v1.0.0
150+
- uses: dcodeIO/setup-node-nvm@v1.0.0
151+
with:
152+
node-version: node
153+
- name: Install dependencies
154+
run: npm ci --no-audit
155+
- name: Clean distribution files
156+
run: npm run clean
157+
- name: Test self-compilation
158+
run: |
159+
npm run asbuild
160+
npm run astest

cli/asc.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ exports.main = function main(argv, options, callback) {
390390
if ((sourceText = readFile(sourcePath = internalPath + ".ts", baseDir)) == null) {
391391
if ((sourceText = readFile(sourcePath = internalPath + "/index.ts", baseDir)) == null) {
392392
// portable d.ts: uses the .js file next to it in JS or becomes an import in Wasm
393-
sourceText = readFile(sourcePath = internalPath + ".d.ts", baseDir);
393+
sourcePath = internalPath + ".ts";
394+
sourceText = readFile(internalPath + ".d.ts", baseDir);
394395
}
395396
}
396397

@@ -478,13 +479,16 @@ exports.main = function main(argv, options, callback) {
478479
var internalPath;
479480
while ((internalPath = assemblyscript.nextFile(program)) != null) {
480481
let file = getFile(internalPath, assemblyscript.getDependee(program, internalPath));
481-
if (!file) return callback(Error("Import file '" + internalPath + ".ts' not found."))
482+
if (!file) return callback(Error("Import '" + internalPath + "' not found."))
482483
stats.parseCount++;
483484
stats.parseTime += measure(() => {
484485
assemblyscript.parse(program, file.sourceText, file.sourcePath, false);
485486
});
486487
}
487-
if (checkDiagnostics(program, stderr)) return callback(Error("Parse error"));
488+
var numErrors = checkDiagnostics(program, stderr);
489+
if (numErrors) {
490+
return callback(Error(numErrors + " parse error(s)"));
491+
}
488492
}
489493

490494
// Include runtime template before entry files so its setup runs first
@@ -579,9 +583,10 @@ exports.main = function main(argv, options, callback) {
579583
} catch (e) {
580584
return callback(e);
581585
}
582-
if (checkDiagnostics(program, stderr)) {
586+
var numErrors = checkDiagnostics(program, stderr);
587+
if (numErrors) {
583588
if (module) module.dispose();
584-
return callback(Error("Compile error"));
589+
return callback(Error(numErrors + " compile error(s)"));
585590
}
586591

587592
// Call afterCompile transform hook
@@ -1023,17 +1028,17 @@ exports.main = function main(argv, options, callback) {
10231028
/** Checks diagnostics emitted so far for errors. */
10241029
function checkDiagnostics(program, stderr) {
10251030
var diagnostic;
1026-
var hasErrors = false;
1031+
var numErrors = 0;
10271032
while ((diagnostic = assemblyscript.nextDiagnostic(program)) != null) {
10281033
if (stderr) {
10291034
stderr.write(
10301035
assemblyscript.formatDiagnostic(diagnostic, stderr.isTTY, true) +
10311036
EOL + EOL
10321037
);
10331038
}
1034-
if (assemblyscript.isError(diagnostic)) hasErrors = true;
1039+
if (assemblyscript.isError(diagnostic)) ++numErrors;
10351040
}
1036-
return hasErrors;
1041+
return numErrors;
10371042
}
10381043

10391044
exports.checkDiagnostics = checkDiagnostics;

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
"all": "npm run check && npm run make",
6464
"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",
6565
"prepublishOnly": "node scripts/prepublish",
66-
"postpublish": "node scripts/postpublish"
66+
"postpublish": "node scripts/postpublish",
67+
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
68+
"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",
69+
"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",
70+
"astest": "ts-node tests/bootstrap"
6771
},
6872
"releaseFiles": [
6973
"lib/rtrace/index.d.ts",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy