Skip to content

Make JS Target value 0 in enum and ASC_VERSION #1318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion std/assembly/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions std/assembly/shared/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
2 changes: 1 addition & 1 deletion std/portable/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ declare type valueof<T extends unknown[]> = 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;
Expand Down
2 changes: 1 addition & 1 deletion std/portable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/compiler/asc-constants.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/compiler/wasi/snapshot_preview1.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down