Infer function expressions in matching contexts (#514)

* legalizes omitting types on function expressions within function type contexts
* legalizes omitting any number of arguments
This commit is contained in:
Daniel Wirtz
2019-02-27 21:45:36 +01:00
committed by GitHub
parent 2945af6557
commit e8b0767143
29 changed files with 1349 additions and 701 deletions

View File

@ -10,7 +10,7 @@
(memory $0 1)
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
(table $0 5 funcref)
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/addI32)
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|0 $function-types/makeAdder<i64>~anonymous|0 $function-types/makeAdder<f64>~anonymous|0 $function-types/addI32)
(global $function-types/i32Adder (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $function-types/i64Adder (mut i32) (i32.const 0))
@ -18,7 +18,7 @@
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $function-types/makeAdder<i32>~anonymous|1 (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $function-types/makeAdder<i32>~anonymous|0 (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
local.get $1
i32.add
@ -26,7 +26,7 @@
(func $function-types/makeAdder<i32> (; 2 ;) (type $i) (result i32)
i32.const 1
)
(func $function-types/makeAdder<i64>~anonymous|2 (; 3 ;) (type $III) (param $0 i64) (param $1 i64) (result i64)
(func $function-types/makeAdder<i64>~anonymous|0 (; 3 ;) (type $III) (param $0 i64) (param $1 i64) (result i64)
local.get $0
local.get $1
i64.add
@ -34,7 +34,7 @@
(func $function-types/makeAdder<i64> (; 4 ;) (type $i) (result i32)
i32.const 2
)
(func $function-types/makeAdder<f64>~anonymous|3 (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
(func $function-types/makeAdder<f64>~anonymous|0 (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
local.get $0
local.get $1
f64.add