diff --git a/.eslintrc.js b/.eslintrc.js index 8dc670e2d4..9672dcaa2d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,10 +69,10 @@ module.exports = { // Quite common in scenarios where an iteration starts at `current = this`. "@typescript-eslint/no-this-alias": "off", - // Disabled here, but enabled again for JavaScript files + // Disabled here, but enabled again for JavaScript files. "no-unused-vars": "off", - // Disabled here, but enabled again for TypeScript files + // Disabled here, but enabled again for TypeScript files. "@typescript-eslint/no-unused-vars": "off" }, overrides: [ diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 4df3ba5e2d..b2161353d3 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -40,7 +40,7 @@ declare type anyref = object; // Compiler hints -/** Compiler target. 0 = WASM32, 1 = WASM64, 2 = JS. */ +/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; /** Provided noAssert option. */ declare const ASC_NO_ASSERT: bool; diff --git a/std/assembly/shared/target.ts b/std/assembly/shared/target.ts index d6d0a3a086..680037f34f 100644 --- a/std/assembly/shared/target.ts +++ b/std/assembly/shared/target.ts @@ -2,10 +2,10 @@ /** Compilation target. */ export enum Target { + /** Portable. */ + JS = 0, /** WebAssembly with 32-bit pointers. */ - WASM32 = 0, + WASM32 = 1, /** WebAssembly with 64-bit pointers. Experimental and not supported by any runtime yet. */ - WASM64 = 1, - /** Portable. */ - JS = 2 + WASM64 = 2, } diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index a8fe3d3f53..bc4587db3d 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -33,7 +33,7 @@ declare type valueof = T[0]; // Compiler hints -/** Compiler target. 0 = WASM32, 1 = WASM64, 2 = JS. */ +/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; /** Provided noAssert option. */ declare const ASC_NO_ASSERT: bool; diff --git a/std/portable/index.js b/std/portable/index.js index 604c48aa78..80aeae3834 100644 --- a/std/portable/index.js +++ b/std/portable/index.js @@ -2,7 +2,7 @@ var globalScope = typeof window !== "undefined" && window || typeof global !== "undefined" && global || self; -globalScope.ASC_TARGET = 2; // Target.JS +globalScope.ASC_TARGET = 0; // Target.JS globalScope.ASC_NO_ASSERT = false; globalScope.ASC_MEMORY_BASE = 0; globalScope.ASC_OPTIMIZE_LEVEL = 3; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index a90d03a62a..0f74c055b8 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -2,7 +2,7 @@ (type $none_=>_none (func)) (memory $0 0) (table $0 1 funcref) - (global $~lib/ASC_TARGET i32 (i32.const 0)) + (global $~lib/ASC_TARGET i32 (i32.const 1)) (global $~lib/ASC_NO_ASSERT i32 (i32.const 0)) (global $~lib/ASC_MEMORY_BASE i32 (i32.const 0)) (global $~lib/ASC_OPTIMIZE_LEVEL i32 (i32.const 0)) @@ -20,7 +20,7 @@ (export "memory" (memory $0)) (start $~start) (func $start:asc-constants - i32.const 0 + i32.const 1 drop i32.const 0 drop diff --git a/tests/compiler/wasi/snapshot_preview1.untouched.wat b/tests/compiler/wasi/snapshot_preview1.untouched.wat index ab8cf77c14..350359727e 100644 --- a/tests/compiler/wasi/snapshot_preview1.untouched.wat +++ b/tests/compiler/wasi/snapshot_preview1.untouched.wat @@ -2,10 +2,10 @@ (type $none_=>_none (func)) (memory $0 0) (table $0 1 funcref) - (global $~lib/shared/target/Target.WASM32 i32 (i32.const 0)) - (global $~lib/shared/target/Target.WASM64 i32 (i32.const 1)) - (global $~lib/shared/target/Target.JS i32 (i32.const 2)) - (global $~lib/ASC_TARGET i32 (i32.const 0)) + (global $~lib/shared/target/Target.JS i32 (i32.const 0)) + (global $~lib/shared/target/Target.WASM32 i32 (i32.const 1)) + (global $~lib/shared/target/Target.WASM64 i32 (i32.const 2)) + (global $~lib/ASC_TARGET i32 (i32.const 1)) (global $wasi/snapshot_preview1/sig (mut i32) (i32.const 1)) (export "memory" (memory $0)) (start $~start) @@ -118,7 +118,7 @@ i32.const 0 i32.eq drop - i32.const 0 + i32.const 1 global.get $~lib/shared/target/Target.WASM32 i32.eq drop @@ -182,7 +182,7 @@ i32.const 0 i32.eq drop - i32.const 0 + i32.const 1 global.get $~lib/shared/target/Target.WASM32 i32.eq drop