v.gen.js: fix segfault when anonymous function is declared with assertion (#11009)

pull/11014/head
playX 2021-08-01 07:27:44 +03:00 committed by GitHub
parent 33e4dc3ad3
commit 77e9ed417f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -964,7 +964,9 @@ fn (mut g JsGen) gen_fn_decl(it ast.FnDecl) {
if g.inside_builtin { if g.inside_builtin {
g.builtin_fns << it.name g.builtin_fns << it.name
} }
cur_fn_decl := g.fn_decl
g.gen_method_decl(it) g.gen_method_decl(it)
g.fn_decl = cur_fn_decl
} }
fn fn_has_go(node ast.FnDecl) bool { fn fn_has_go(node ast.FnDecl) bool {
@ -1043,6 +1045,7 @@ fn (mut g JsGen) gen_method_decl(it ast.FnDecl) {
g.writeln('$name = new array($name);') g.writeln('$name = new array($name);')
} }
} }
g.stmts(it.stmts) g.stmts(it.stmts)
g.write('}') g.write('}')
if is_main { if is_main {