mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 12:11:50 +00:00
Use outer-most identifier when resolving queued exports, fixes #248
This commit is contained in:
39
tests/compiler/rereexport.optimized.wat
Normal file
39
tests/compiler/rereexport.optimized.wat
Normal file
@ -0,0 +1,39 @@
|
||||
(module
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(global $export/a i32 (i32.const 1))
|
||||
(global $export/b i32 (i32.const 2))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "a" (global $export/a))
|
||||
(export "renamed_a" (global $export/a))
|
||||
(export "renamed_b" (global $export/b))
|
||||
(export "renamed_renamed_b" (global $export/b))
|
||||
(start $start)
|
||||
(func $export/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $export/mul (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $start (; 2 ;) (; has Stack IR ;) (type $v)
|
||||
(drop
|
||||
(i32.add
|
||||
(call $export/add
|
||||
(i32.const 1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(call $export/mul
|
||||
(i32.const 3)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
6
tests/compiler/rereexport.ts
Normal file
6
tests/compiler/rereexport.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export {
|
||||
a,
|
||||
a as renamed_a,
|
||||
renamed_b,
|
||||
renamed_b as renamed_renamed_b
|
||||
} from "./reexport";
|
41
tests/compiler/rereexport.untouched.wat
Normal file
41
tests/compiler/rereexport.untouched.wat
Normal file
@ -0,0 +1,41 @@
|
||||
(module
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(global $export/a i32 (i32.const 1))
|
||||
(global $export/b i32 (i32.const 2))
|
||||
(global $export/c i32 (i32.const 3))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "a" (global $export/a))
|
||||
(export "renamed_a" (global $export/a))
|
||||
(export "renamed_b" (global $export/b))
|
||||
(export "renamed_renamed_b" (global $export/b))
|
||||
(start $start)
|
||||
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $export/mul (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $start (; 2 ;) (type $v)
|
||||
(drop
|
||||
(i32.add
|
||||
(call $export/add
|
||||
(i32.const 1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(call $export/mul
|
||||
(i32.const 3)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@ -136,7 +136,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 16)
|
||||
(i32.const 241)
|
||||
(i32.const 239)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
|
@ -221,7 +221,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 16)
|
||||
(i32.const 241)
|
||||
(i32.const 239)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
|
@ -7673,7 +7673,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 1296)
|
||||
(i32.const 56)
|
||||
(i32.const 54)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -7748,7 +7748,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 1296)
|
||||
(i32.const 108)
|
||||
(i32.const 106)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
|
@ -12195,7 +12195,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 1296)
|
||||
(i32.const 56)
|
||||
(i32.const 54)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -12289,7 +12289,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 1296)
|
||||
(i32.const 108)
|
||||
(i32.const 106)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
|
@ -25,8 +25,8 @@
|
||||
(data (i32.const 8) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g")
|
||||
(data (i32.const 48) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 80) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 112) "\01")
|
||||
(data (i32.const 120) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 112) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 168) "\01")
|
||||
(data (i32.const 176) "\01\00\00\006")
|
||||
(data (i32.const 184) "\02\00\00\004\d8\06\df")
|
||||
(data (i32.const 192) "\02\00\00\00h\00i")
|
||||
@ -119,7 +119,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 73)
|
||||
(i32.const 71)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -254,7 +254,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 120)
|
||||
(i32.const 112)
|
||||
(i32.const 14)
|
||||
(i32.const 2)
|
||||
)
|
||||
@ -279,14 +279,6 @@
|
||||
)
|
||||
(func $~lib/string/String.fromCharCode (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(return
|
||||
(i32.const 112)
|
||||
)
|
||||
)
|
||||
(i32.store16 offset=4
|
||||
(tee_local $1
|
||||
(call $~lib/internal/string/allocateUnsafe
|
||||
@ -430,20 +422,12 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 31)
|
||||
(i32.const 30)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(return
|
||||
(i32.const 112)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(call $~lib/internal/string/allocateUnsafe
|
||||
(i32.add
|
||||
@ -504,7 +488,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 241)
|
||||
(i32.const 239)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -576,7 +560,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 122)
|
||||
(i32.const 120)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -672,7 +656,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 210)
|
||||
(i32.const 208)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2787,7 +2771,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 347)
|
||||
(i32.const 345)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2931,7 +2915,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 367)
|
||||
(i32.const 365)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3077,7 +3061,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 226)
|
||||
(i32.const 224)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3732,7 +3716,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 515)
|
||||
(i32.const 513)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3830,7 +3814,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 108)
|
||||
(i32.const 106)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -4226,7 +4210,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 387)
|
||||
(i32.const 385)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -4262,7 +4246,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 392)
|
||||
(i32.const 390)
|
||||
(i32.const 6)
|
||||
)
|
||||
(unreachable)
|
||||
@ -4975,7 +4959,7 @@
|
||||
(call $~lib/string/String.fromCharCode
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 112)
|
||||
(i32.const 168)
|
||||
)
|
||||
)
|
||||
(block
|
||||
@ -5032,7 +5016,7 @@
|
||||
(call $~lib/string/String.fromCodePoint
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 112)
|
||||
(i32.const 168)
|
||||
)
|
||||
)
|
||||
(block
|
||||
|
@ -66,8 +66,8 @@
|
||||
(data (i32.const 8) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00")
|
||||
(data (i32.const 48) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 80) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 112) "\01\00\00\00\00\00")
|
||||
(data (i32.const 120) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 112) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 168) "\01\00\00\00\00\00")
|
||||
(data (i32.const 176) "\01\00\00\006\00")
|
||||
(data (i32.const 184) "\02\00\00\004\d8\06\df")
|
||||
(data (i32.const 192) "\02\00\00\00h\00i\00")
|
||||
@ -164,7 +164,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 73)
|
||||
(i32.const 71)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -324,7 +324,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 120)
|
||||
(i32.const 112)
|
||||
(i32.const 14)
|
||||
(i32.const 2)
|
||||
)
|
||||
@ -357,14 +357,6 @@
|
||||
)
|
||||
(func $~lib/string/String.fromCharCode (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(return
|
||||
(i32.const 112)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(call $~lib/internal/string/allocateUnsafe
|
||||
(i32.const 1)
|
||||
@ -520,20 +512,12 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 31)
|
||||
(i32.const 30)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(return
|
||||
(i32.const 112)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.gt_s
|
||||
(get_local $0)
|
||||
@ -613,7 +597,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 241)
|
||||
(i32.const 239)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -705,7 +689,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 122)
|
||||
(i32.const 120)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -817,7 +801,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 210)
|
||||
(i32.const 208)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3465,7 +3449,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 347)
|
||||
(i32.const 345)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3615,7 +3599,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 367)
|
||||
(i32.const 365)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3766,7 +3750,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 226)
|
||||
(i32.const 224)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -4479,7 +4463,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 515)
|
||||
(i32.const 513)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
@ -4588,7 +4572,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 108)
|
||||
(i32.const 106)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -5026,7 +5010,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 387)
|
||||
(i32.const 385)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -5061,7 +5045,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 80)
|
||||
(i32.const 392)
|
||||
(i32.const 390)
|
||||
(i32.const 6)
|
||||
)
|
||||
(unreachable)
|
||||
@ -5969,7 +5953,7 @@
|
||||
(call $~lib/string/String.fromCharCode
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 112)
|
||||
(i32.const 168)
|
||||
)
|
||||
)
|
||||
(block
|
||||
@ -6029,7 +6013,7 @@
|
||||
(call $~lib/string/String.fromCodePoint
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 112)
|
||||
(i32.const 168)
|
||||
)
|
||||
)
|
||||
(block
|
||||
|
Reference in New Issue
Block a user