cgen: fix multiple array.map(anon_fn) calls
parent
a130d3cd14
commit
12faf9fcfa
|
@ -596,6 +596,18 @@ fn test_anon_fn_map() {
|
||||||
assert [1,2,3].map(add_num) == [2,3,4]
|
assert [1,2,3].map(add_num) == [2,3,4]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_mutli_anon_fn_map() {
|
||||||
|
a := [1,2,3].map(fn (i int) int {
|
||||||
|
return i + 1
|
||||||
|
})
|
||||||
|
|
||||||
|
b := [1,2,3].map(fn (i int) int {
|
||||||
|
return i + 2
|
||||||
|
})
|
||||||
|
assert a == [2,3,4]
|
||||||
|
assert b == [3,4,5]
|
||||||
|
}
|
||||||
|
|
||||||
fn test_anon_fn_arg_map() {
|
fn test_anon_fn_arg_map() {
|
||||||
a := [1,2,3].map(fn (i int) int {
|
a := [1,2,3].map(fn (i int) int {
|
||||||
return i + 1
|
return i + 1
|
||||||
|
|
|
@ -49,7 +49,6 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
|
||||||
eprintln('INFO: compile with `v -live $g.pref.path `, if you want to use the [live] function ${it.name} .')
|
eprintln('INFO: compile with `v -live $g.pref.path `, if you want to use the [live] function ${it.name} .')
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
g.reset_tmp_count()
|
|
||||||
if is_main {
|
if is_main {
|
||||||
if g.pref.os == .windows {
|
if g.pref.os == .windows {
|
||||||
if g.is_gui_app() {
|
if g.is_gui_app() {
|
||||||
|
|
Loading…
Reference in New Issue