Skip to content

Commit 6014dfe

Browse files
committed
Merge branch 'main' into HEAD
2 parents 4d1f63c + 0ed65eb commit 6014dfe

File tree

195 files changed

+22074
-20263
lines changed

Some content is hidden

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

195 files changed

+22074
-20263
lines changed

.c8rc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"reporter": ["html", "text"],
3+
"reportsDirectory": "./coverage",
4+
"src": ["src"],
5+
"exclude": [
6+
"std/**/*",
7+
"tests/**/*",
8+
"dist/**/*",
9+
"bin/asinit.js",
10+
"lib/**/*",
11+
"scripts/**/*",
12+
"src/glue/wasm/**/*",
13+
"util/browser/**/*"
14+
],
15+
"clean": true,
16+
"exclude-after-remap": true
17+
}

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ jobs:
5858
run: npm ci --no-audit
5959
- name: Build
6060
run: npm run build
61-
- name: Bootstrap
61+
- name: "Bootstrap ${{ matrix.target }}"
6262
run: npm run bootstrap:${{ matrix.target }}
63-
- name: Test
63+
- name: "Test ${{ matrix.target }}"
6464
run: npm run test:compiler -- --wasm build/assemblyscript.${{ matrix.target }}-bootstrap.js
65+
- name: "Compile ${{ matrix.target }} -> ${{ matrix.target == 'debug' && 'release' || 'debug' }}"
66+
run: node bin/asc --config src/asconfig.json --target ${{ matrix.target == 'debug' && 'release' || 'debug' }}-bootstrap --wasm ./build/assemblyscript.${{ matrix.target }}-bootstrap.js
67+
- name: "Test ${{ matrix.target == 'debug' && 'release' || 'debug' }}"
68+
run: npm run test:compiler -- --wasm build/assemblyscript.${{ matrix.target == 'debug' && 'release' || 'debug' }}-bootstrap.js
6569
features:
6670
name: "Features"
6771
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ raw/
99
.idea
1010
cli/index.generated.js
1111
src/diagnosticMessages.generated.ts
12+
coverage/

cli/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,18 @@ export async function main(argv, options) {
651651

652652
// Include entry files
653653
for (let i = 0, k = argv.length; i < k; ++i) {
654-
const filename = argv[i];
655-
let sourcePath = String(filename)
656-
.replace(/\\/g, "/")
657-
.replace(extension_re, "")
658-
.replace(/[\\/]$/, "");
654+
const filename = String(argv[i]);
659655

660656
// Setting the path to relative path
661-
sourcePath = path.isAbsolute(sourcePath)
662-
? path.relative(baseDir, sourcePath).replace(/\\/g, "/")
663-
: sourcePath;
657+
let sourcePath = path.isAbsolute(filename)
658+
? path.relative(baseDir, filename)
659+
: path.normalize(filename);
664660

661+
sourcePath = sourcePath
662+
.replace(/\\/g, "/")
663+
.replace(extension_re, "")
664+
.replace(/\/$/, "");
665+
665666
// Try entryPath.ext, then entryPath/index.ext
666667
let sourceText = await readFile(sourcePath + extension, baseDir);
667668
if (sourceText == null) {

cli/options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@
204204
" simd SIMD types and operations.",
205205
" reference-types Reference types and operations.",
206206
" gc Garbage collection (WIP).",
207+
" stringref String reference types.",
207208
""
208209
],
209210
"TODO_doesNothingYet": [
210211
" exception-handling Exception handling.",
211212
" tail-calls Tail call operations.",
212213
" multi-value Multi value types.",
213214
" memory64 Memory64 operations.",
214-
" function-references Function reference types.",
215215
" relaxed-simd Relaxed SIMD operations.",
216216
" extended-const Extended const expressions."
217217
],

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"engineStrict": true,
2727
"dependencies": {
28-
"binaryen": "109.0.0-nightly.20220831",
28+
"binaryen": "110.0.0-nightly.20220924",
2929
"long": "^5.2.0"
3030
},
3131
"devDependencies": {
@@ -70,6 +70,7 @@
7070
"lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
7171
"build": "node scripts/build",
7272
"watch": "node scripts/build --watch",
73+
"coverage": "npx c8 -- npm test",
7374
"test": "npm run test:parser && npm run test:compiler -- --parallel && npm run test:browser && npm run test:asconfig && npm run test:transform",
7475
"test:parser": "node --enable-source-maps tests/parser",
7576
"test:compiler": "node --enable-source-maps --no-warnings tests/compiler",

scripts/unicode-identifier.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// see https://github.com/microsoft/TypeScript/blob/main/scripts/regenerate-unicode-identifier-parts.js
2+
3+
const MAX_UNICODE_CODEPOINT = 0x10FFFF;
4+
const isStart = c => /[\p{ID_Start}\u{2118}\u{212E}\u{309B}\u{309C}]/u.test(c); // Other_ID_Start explicitly included for back compat - see http://www.unicode.org/reports/tr31/#Introduction
5+
const isPart = c => /[\p{ID_Continue}\u{00B7}\u{0387}\u{19DA}\u{1369}\u{136A}\u{136B}\u{136C}\u{136D}\u{136E}\u{136F}\u{1370}\u{1371}]/u.test(c) || isStart(c); // Likewise for Other_ID_Continue
6+
const parts = [];
7+
let partsActive = false;
8+
let startsActive = false;
9+
const starts = [];
10+
11+
// Skip 0-9 (48..57), A-Z (65..90), a-z (97..122) - checked otherwise
12+
for (let cp = 123; cp <= MAX_UNICODE_CODEPOINT; cp++) {
13+
if (isStart(String.fromCodePoint(cp)) !== startsActive) {
14+
starts.push(cp - +startsActive);
15+
startsActive = !startsActive;
16+
}
17+
if (isPart(String.fromCodePoint(cp)) !== partsActive) {
18+
parts.push(cp - +partsActive);
19+
partsActive = !partsActive;
20+
}
21+
}
22+
if (startsActive) starts.push(MAX_UNICODE_CODEPOINT);
23+
if (partsActive) parts.push(MAX_UNICODE_CODEPOINT);
24+
25+
function tablify(cps) {
26+
let sb = ["/*\n| from ... to | from ... to | from ... to | from ... to |*/"];
27+
let i = 0;
28+
while (i < cps.length) {
29+
if (!(i % 8)) sb.push("\n ");
30+
sb.push(`${cps[i++].toString().padEnd(6)}, `);
31+
}
32+
return sb.join("") + "\n";
33+
}
34+
35+
console.log(`/** Unicode ${process.versions.unicode} ID_Start/Other_ID_Start ranges */`);
36+
console.log(`const unicodeIdentifierStart: i32[] = [${tablify(starts)}];`);
37+
console.log(`const unicodeIdentifierStartMin = ${starts[0]};`);
38+
console.log(`const unicodeIdentifierStartMax = ${starts[starts.length - 1]};\n`);
39+
console.log(`/** Unicode ${process.versions.unicode} ID_Continue/Other_ID_Continue + ID_Start/Other_ID_Start ranges*/`);
40+
console.log(`const unicodeIdentifierPart: i32[] = [${tablify(parts)}];`);
41+
console.log(`const unicodeIdentifierPartMin = ${parts[0]};`);
42+
console.log(`const unicodeIdentifierPartMax = ${parts[parts.length - 1]};\n`);

scripts/update-constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var src = fs.readFileSync(srcfile, "utf8")
1515
if (val.startsWith("binaryen.")) {
1616
return $0;
1717
}
18-
var match = val.match(/\b(_(?:Binaryen|Relooper|ExpressionRunner)\w+)\b/);
18+
var match = val.match(/\b(_(?:Binaryen|Relooper|ExpressionRunner|TypeBuilder)\w+)\b/);
1919
if (match) {
2020
let fn = match[1];
2121
if (typeof binaryen[fn] !== "function") throw Error("API mismatch on '" + fn + "': Is Binaryen up to date?");

src/builtins.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,11 @@ function builtin_assert(ctx: BuiltinContext): ExpressionRef {
34923492
case TypeKind.ANYREF:
34933493
case TypeKind.EQREF:
34943494
case TypeKind.DATAREF:
3495-
case TypeKind.I31REF: return module.if(module.ref_is(RefIsOp.Null, arg0), abort);
3495+
case TypeKind.I31REF:
3496+
case TypeKind.STRINGREF:
3497+
case TypeKind.STRINGVIEW_WTF8:
3498+
case TypeKind.STRINGVIEW_WTF16:
3499+
case TypeKind.STRINGVIEW_ITER: return module.if(module.ref_is(RefIsOp.Null, arg0), abort);
34963500

34973501
}
34983502
} else {
@@ -3574,7 +3578,11 @@ function builtin_assert(ctx: BuiltinContext): ExpressionRef {
35743578
case TypeKind.ANYREF:
35753579
case TypeKind.EQREF:
35763580
case TypeKind.DATAREF:
3577-
case TypeKind.I31REF: {
3581+
case TypeKind.I31REF:
3582+
case TypeKind.STRINGREF:
3583+
case TypeKind.STRINGVIEW_WTF8:
3584+
case TypeKind.STRINGVIEW_WTF16:
3585+
case TypeKind.STRINGVIEW_ITER: {
35783586
let temp = flow.getTempLocal(type);
35793587
let ret = module.if(
35803588
module.ref_is(RefIsOp.Null,

0 commit comments

Comments
 (0)