Implement optional type parameters (#360)

* Add a NATIVE<T> macro type to simplify use of a native WebAssembly type
* Add default type parameters for internal helpers for explicit loads and stores
* Unify loadUnsafe/loadUnsafeWithOffset etc. into one
* Renamed loadUnsafe etc. into just LOAD, like a macro
* Implement parsing of index signatures, but ignore them, for properly linting code
* Refactor TypedArray<T> to use macros
This commit is contained in:
Daniel Wirtz
2018-12-07 14:33:32 +01:00
committed by GitHub
parent d7f4874650
commit ebae7cbd73
39 changed files with 4698 additions and 4128 deletions

View File

@ -27,6 +27,7 @@
(export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall))
(func $~lib/array/Array<Array<i32>>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
get_local $0
i32.load
set_local $2
@ -37,11 +38,15 @@
i32.shr_u
i32.lt_u
if (result i32)
i32.const 0
set_local $3
get_local $2
get_local $1
i32.const 2
i32.shl
i32.add
get_local $3
i32.add
i32.load offset=8
else
unreachable
@ -49,6 +54,7 @@
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
get_local $0
i32.load
set_local $2
@ -59,11 +65,15 @@
i32.shr_u
i32.lt_u
if (result i32)
i32.const 0
set_local $3
get_local $2
get_local $1
i32.const 2
i32.shl
i32.add
get_local $3
i32.add
i32.load offset=8
else
unreachable
@ -78,6 +88,7 @@
)
(func $~lib/array/Array<String>#__get (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
get_local $0
i32.load
set_local $2
@ -88,11 +99,15 @@
i32.shr_u
i32.lt_u
if (result i32)
i32.const 0
set_local $3
get_local $2
get_local $1
i32.const 2
i32.shl
i32.add
get_local $3
i32.add
i32.load offset=8
else
unreachable
@ -234,6 +249,7 @@
)
(func $~lib/array/Array<Array<String>>#__get (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
get_local $0
i32.load
set_local $2
@ -244,11 +260,15 @@
i32.shr_u
i32.lt_u
if (result i32)
i32.const 0
set_local $3
get_local $2
get_local $1
i32.const 2
i32.shl
i32.add
get_local $3
i32.add
i32.load offset=8
else
unreachable