mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 06:51:34 +00:00
Type aliases
This commit is contained in:
14
tests/compiler/typealias.optimized.wast
Normal file
14
tests/compiler/typealias.optimized.wast
Normal file
@ -0,0 +1,14 @@
|
||||
(module
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(export "alias" (func $typealias/alias))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $typealias/alias (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
5
tests/compiler/typealias.ts
Normal file
5
tests/compiler/typealias.ts
Normal file
@ -0,0 +1,5 @@
|
||||
type alias = i32;
|
||||
|
||||
export function alias(a: alias): alias {
|
||||
return a;
|
||||
}
|
67
tests/compiler/typealias.wast
Normal file
67
tests/compiler/typealias.wast
Normal file
@ -0,0 +1,67 @@
|
||||
(module
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 4))
|
||||
(memory $0 1)
|
||||
(export "alias" (func $typealias/alias))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $typealias/alias (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(return
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
(;
|
||||
[program.elements]
|
||||
NaN
|
||||
Infinity
|
||||
isNaN
|
||||
isFinite
|
||||
clz
|
||||
ctz
|
||||
popcnt
|
||||
rotl
|
||||
rotr
|
||||
abs
|
||||
max
|
||||
min
|
||||
ceil
|
||||
floor
|
||||
copysign
|
||||
nearest
|
||||
reinterpret
|
||||
sqrt
|
||||
trunc
|
||||
load
|
||||
store
|
||||
sizeof
|
||||
select
|
||||
unreachable
|
||||
current_memory
|
||||
grow_memory
|
||||
parseInt
|
||||
parseFloat
|
||||
changetype
|
||||
assert
|
||||
i8
|
||||
i16
|
||||
i32
|
||||
i64
|
||||
u8
|
||||
u16
|
||||
u32
|
||||
u64
|
||||
bool
|
||||
f32
|
||||
f64
|
||||
isize
|
||||
usize
|
||||
HEAP_BASE
|
||||
typealias/alias
|
||||
[program.exports]
|
||||
typealias/alias
|
||||
;)
|
Reference in New Issue
Block a user