compiler: support calling function literals
This commit is contained in:
parent
b4bcd23c0f
commit
d73f3cd24c
2 changed files with 19 additions and 0 deletions
|
@ -13,3 +13,16 @@ func TestFuncLiteral(t *testing.T) {
|
|||
}`
|
||||
eval(t, src, big.NewInt(5))
|
||||
}
|
||||
|
||||
func TestCallInPlace(t *testing.T) {
|
||||
src := `package foo
|
||||
var a int = 1
|
||||
func Main() int {
|
||||
func() {
|
||||
a += 10
|
||||
}()
|
||||
a += 100
|
||||
return a
|
||||
}`
|
||||
eval(t, src, big.NewInt(111))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue