Rework resolver (#489)

* Rework IR and resolver to use nested lookup tables
* Integrate types into IR
* Make components prefer IR, slimmed down AST
* Implement `export *`
* Add `@lazy` annotation and remove `--noTreeShaking`
* Add `@start` annotation and remove magic `main`
* Related refactoring, cleanup and docs
This commit is contained in:
Daniel Wirtz
2019-02-21 00:11:22 +01:00
committed by GitHub
parent e623786b42
commit 0c64f21250
234 changed files with 16949 additions and 37871 deletions

View File

@ -1,29 +1,32 @@
(module
(type $iii (func (param i32 i32) (result i32)))
(type $_ (func))
(type $iii (func (param i32 i32) (result i32)))
(memory $0 0)
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $main/code (mut i32) (i32.const 0))
(global $~started (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 8))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $main/main))
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
global.get $~started
(func $start:main (; 0 ;) (type $_)
i32.const 1
global.set $main/code
)
(func $main/main (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~started
global.set $~lib/started
end
global.get $main/code
)
(func $start (; 1 ;) (type $_)
i32.const 1
global.set $main/code
(func $start (; 2 ;) (type $_)
call $start:main
)
(func $null (; 2 ;) (type $_)
(func $null (; 3 ;) (type $_)
)
)