Allow keywords in named import/export syntax (#107)

This commit is contained in:
Alan Pierce
2018-05-13 04:26:12 -07:00
committed by Daniel Wirtz
parent e415377cda
commit 5ab81a00a1
8 changed files with 119 additions and 35 deletions

View File

@ -0,0 +1,9 @@
(module
(type $i (func (result i32)))
(memory $0 1)
(export "default" (func $named-export-default/get3))
(export "memory" (memory $0))
(func $named-export-default/get3 (; 0 ;) (type $i) (result i32)
(i32.const 3)
)
)

View File

@ -0,0 +1,5 @@
function get3(): i32 {
return 3;
}
export {get3 as default};

View File

@ -0,0 +1,12 @@
(module
(type $i (func (result i32)))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "default" (func $named-export-default/get3))
(export "memory" (memory $0))
(func $named-export-default/get3 (; 0 ;) (type $i) (result i32)
(return
(i32.const 3)
)
)
)

View File

@ -0,0 +1,12 @@
(module
(type $i (func (result i32)))
(memory $0 1)
(export "getValue" (func $named-import-default/getValue))
(export "memory" (memory $0))
(func $named-export-default/get3 (; 0 ;) (type $i) (result i32)
(i32.const 3)
)
(func $named-import-default/getValue (; 1 ;) (type $i) (result i32)
(call $named-export-default/get3)
)
)

View File

@ -0,0 +1,7 @@
import {
default as get3
} from "./named-export-default";
export function getValue(): i32 {
return get3();
}

View File

@ -0,0 +1,17 @@
(module
(type $i (func (result i32)))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "getValue" (func $named-import-default/getValue))
(export "memory" (memory $0))
(func $named-export-default/get3 (; 0 ;) (type $i) (result i32)
(return
(i32.const 3)
)
)
(func $named-import-default/getValue (; 1 ;) (type $i) (result i32)
(return
(call $named-export-default/get3)
)
)
)