Skip to content

Commit

Permalink
chore: Rename anyref to externref to match proposal change (#1319)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `anyref` type has been renamed to `externref` and support for externref `null` values has been temporarily disabled.
  • Loading branch information
jayphelps committed Jul 16, 2020
1 parent 5207bcb commit 0234c8b
Show file tree
Hide file tree
Showing 20 changed files with 168 additions and 256 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ jobs:
- uses: dcodeIO/setup-node-nvm@master
with:
node-mirror: https://nodejs.org/download/v8-canary/
# FIXME: newer node-v8 builds are currently broken
node-version: "14.0.0-v8-canary201911242015a12d82"
node-version: "15.0.0-v8-canary202007077c53168ead"
- name: Install dependencies
run: npm ci --no-audit
- name: Clean distribution files
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
},
"dependencies": {
"binaryen": "93.0.0-nightly.20200609",
"binaryen": "93.0.0-nightly.20200611",
"long": "^4.0.0",
"source-map-support": "^0.5.19",
"ts-node": "^6.2.0"
Expand Down
15 changes: 8 additions & 7 deletions src/builtins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ function builtin_nameof(ctx: BuiltinContext): ExpressionRef {
if (signatureReference) {
value = "Function";
} else {
value = "Anyref";
value = "Externref";
}
}
} else {
Expand All @@ -990,7 +990,7 @@ function builtin_nameof(ctx: BuiltinContext): ExpressionRef {
case TypeKind.ISIZE: { value = "isize"; break; }
case TypeKind.USIZE: { value = "usize"; break; }
case TypeKind.V128: { value = "v128"; break; }
case TypeKind.ANYREF: { value = "anyref"; break; }
case TypeKind.EXTERNREF: { value = "externref"; break; }
default: assert(false);
case TypeKind.VOID: { value = "void"; break; }
}
Expand Down Expand Up @@ -2440,7 +2440,8 @@ function builtin_select(ctx: BuiltinContext): ExpressionRef {
var arg1 = compiler.compileExpression(operands[1], type, Constraints.CONV_IMPLICIT);
var arg2 = compiler.makeIsTrueish(
compiler.compileExpression(operands[2], Type.bool),
compiler.currentType // ^
compiler.currentType, // ^
operands[2]
);
compiler.currentType = type;
return module.select(arg0, arg1, arg2);
Expand Down Expand Up @@ -2577,9 +2578,9 @@ function builtin_memory_data(ctx: BuiltinContext): ExpressionRef {
let exprs = new Array<ExpressionRef>(numElements);
let isStatic = true;
for (let i = 0; i < numElements; ++i) {
let expression = expressions[i];
if (expression) {
let expr = compiler.compileExpression(expression, elementType,
let elementExpression = expressions[i];
if (elementExpression) {
let expr = compiler.compileExpression(elementExpression, elementType,
Constraints.CONV_IMPLICIT | Constraints.WILL_RETAIN
);
let precomp = module.runExpression(expr, ExpressionRunnerFlags.PreserveSideeffects);
Expand All @@ -2590,7 +2591,7 @@ function builtin_memory_data(ctx: BuiltinContext): ExpressionRef {
}
exprs[i] = expr;
} else {
exprs[i] = compiler.makeZero(elementType);
exprs[i] = compiler.makeZero(elementType, valuesOperand);
}
}
if (!isStatic) {
Expand Down
4 changes: 2 additions & 2 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export namespace CommonNames {
export const f32 = "f32";
export const f64 = "f64";
export const v128 = "v128";
export const anyref = "anyref";
export const externref = "externref";
export const i8x16 = "i8x16";
export const u8x16 = "u8x16";
export const i16x8 = "i16x8";
Expand Down Expand Up @@ -185,7 +185,7 @@ export namespace CommonNames {
export const F32 = "F32";
export const F64 = "F64";
export const V128 = "V128";
export const Anyref = "Anyref";
export const Externref = "Externref";
export const String = "String";
export const Array = "Array";
export const StaticArray = "StaticArray";
Expand Down
Loading

0 comments on commit 0234c8b

Please sign in to comment.