Skip to content

Commit 9d8c225

Browse files
committed
feat: complete tail-call detection and runtime coverage
Merge current main and detect tail calls after conversions and runtime instrumentation. Cover control flow, wrappers, adjacent temporary returns, argument order, optional arguments, GC cleanup, and feature gating. Run the tail-call regression suite in CI, including deep recursion in debug and release builds.
2 parents c33df89 + b6bda05 commit 9d8c225

192 files changed

Lines changed: 238003 additions & 232424 deletions

File tree

Some content is hidden

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

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ jobs:
8181
run: npm run build
8282
- name: Test experimental features
8383
env:
84-
ASC_FEATURES: threads,reference-types,gc,exception-handling
84+
ASC_FEATURES: threads,reference-types,gc,exception-handling,tail-calls
8585
run: |
86-
npm run test:compiler features/threads features/reference-types features/gc features/exception-handling bindings/esm bindings/raw
86+
npm run test:compiler features/threads features/reference-types features/gc features/exception-handling features/tail-calls bindings/esm bindings/raw
8787
runtimes:
8888
name: "Runtimes"
8989
runs-on: ubuntu-latest

‎NOTICE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ under the licensing terms detailed in LICENSE:
5151
* Adrien Zinger <zinger.ad@gmail.com>
5252
* Ruixiang Chen <xiang19890319@gmail.com>
5353
* Daniel Salvadori <danaugrs@gmail.com>
54-
* Jairus Tanaka <jairus.v.tanaka@outlook.com>
54+
* Jairus Tanaka <me@jairus.dev>
5555
* CountBleck <Mr.YouKnowWhoIAm@protonmail.com>
5656
* Abdul Rauf <abdulraufmujahid@gmail.com>
5757
* Bach Le <bach@bullno1.com>

‎package-lock.json‎

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

‎package.json‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
},
2626
"engineStrict": true,
2727
"dependencies": {
28-
"binaryen": "123.0.0-nightly.20250530",
28+
"binaryen": "131.0.0-nightly.20260721",
2929
"long": "^5.2.4"
3030
},
3131
"devDependencies": {
3232
"@eslint/js": "^10.0.1",
33-
"@types/node": "^25.5.0",
33+
"@types/node": "^26.1.1",
3434
"as-float": "^1.0.1",
35-
"diff": "^8.0.4",
36-
"esbuild": "^0.27.0",
37-
"eslint": "^10.1.0",
35+
"diff": "^9.0.0",
36+
"esbuild": "^0.28.1",
37+
"eslint": "^10.7.0",
3838
"glob": "^13.0.6",
39-
"globals": "^17.4.0",
40-
"typescript": "^5.9.3",
41-
"typescript-eslint": "^8.57.2"
39+
"globals": "^17.7.0",
40+
"typescript": "^6.0.3",
41+
"typescript-eslint": "^8.65.0"
4242
},
4343
"type": "module",
4444
"exports": {
@@ -74,7 +74,7 @@
7474
"scripts": {
7575
"check": "npm run check:config && npm run check:import && npm run lint",
7676
"check:config": "tsc --noEmit -p src --diagnostics --listFiles",
77-
"check:import": "tsc --noEmit --target ESNEXT --module nodenext --moduleResolution nodenext --experimentalDecorators tests/import/index",
77+
"check:import": "tsc --noEmit --skipLibCheck --target ESNEXT --module nodenext --moduleResolution nodenext --experimentalDecorators tests/import/index",
7878
"lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
7979
"build": "node scripts/build",
8080
"watch": "node scripts/build --watch",

‎scripts/build-dts.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ const prefix = "types:assemblyscript";
319319

320320
export function generateSrc() {
321321
const stdout = [];
322+
const pathToSources = pathUtil.resolve(__dirname, "..", "src");
322323

323324
generate({
324-
project: pathUtil.resolve(__dirname, "..", "src"),
325+
project: pathToSources,
326+
baseDir: pathToSources,
325327
prefix,
326328
exclude: [
327329
"glue/**",

‎src/ast.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const enum NodeKind {
5050
// types
5151
NamedType,
5252
FunctionType,
53+
TupleType,
5354
TypeName,
5455
TypeParameter,
5556
Parameter,
@@ -161,6 +162,15 @@ export abstract class Node {
161162
return new FunctionTypeNode(parameters, returnType, explicitThisType, isNullable, range);
162163
}
163164

165+
static createTupleType(
166+
elements: TypeNode[],
167+
elementNames: (IdentifierExpression | null)[] | null,
168+
isNullable: bool,
169+
range: Range
170+
): TupleTypeNode {
171+
return new TupleTypeNode(elements, elementNames, isNullable, range);
172+
}
173+
164174
static createOmittedType(
165175
range: Range
166176
): NamedTypeNode {
@@ -862,6 +872,12 @@ export abstract class TypeNode extends Node {
862872
if (functionTypeNode.returnType.hasGenericComponent(typeParameterNodes)) return true;
863873
let explicitThisType = functionTypeNode.explicitThisType;
864874
if (explicitThisType && explicitThisType.hasGenericComponent(typeParameterNodes)) return true;
875+
} else if (this.kind == NodeKind.TupleType) {
876+
let tupleTypeNode = <TupleTypeNode>changetype<TypeNode>(this);
877+
let elements = tupleTypeNode.elements;
878+
for (let i = 0, k = elements.length; i < k; ++i) {
879+
if (elements[i].hasGenericComponent(typeParameterNodes)) return true;
880+
}
865881
} else {
866882
assert(false);
867883
}
@@ -928,6 +944,22 @@ export class FunctionTypeNode extends TypeNode {
928944
}
929945
}
930946

947+
/** Represents a tuple type. */
948+
export class TupleTypeNode extends TypeNode {
949+
constructor(
950+
/** Tuple elements. */
951+
public elements: TypeNode[],
952+
/** Tuple element names, if any. */
953+
public elementNames: (IdentifierExpression | null)[] | null,
954+
/** Whether nullable or not. */
955+
isNullable: bool,
956+
/** Source range. */
957+
range: Range
958+
) {
959+
super(NodeKind.TupleType, isNullable, range);
960+
}
961+
}
962+
931963
/** Represents a type parameter. */
932964
export class TypeParameterNode extends Node {
933965
constructor(

‎src/common.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export namespace CommonNames {
191191
export const ASC_FEATURE_RELAXED_SIMD = "ASC_FEATURE_RELAXED_SIMD";
192192
export const ASC_FEATURE_EXTENDED_CONST = "ASC_FEATURE_EXTENDED_CONST";
193193
export const ASC_FEATURE_STRINGREF = "ASC_FEATURE_STRINGREF";
194+
export const ASC_FEATURE_SHARED_EVERYTHING = "ASC_FEATURE_SHARED_EVERYTHING";
194195
export const ASC_VERSION_MAJOR = "ASC_VERSION_MAJOR";
195196
export const ASC_VERSION_MINOR = "ASC_VERSION_MINOR";
196197
export const ASC_VERSION_PATCH = "ASC_VERSION_PATCH";

0 commit comments

Comments
 (0)