Don't recurse into inner functions during asyncjs transform (#23036)

Closes #13341
This commit is contained in:
Jake Leahy
2023-12-06 14:59:38 +11:00
committed by GitHub
parent d20b4d5168
commit 44b64e726e
2 changed files with 7 additions and 0 deletions

View File

@@ -90,6 +90,8 @@ proc replaceReturn(node: var NimNode) =
node[z] = nnkReturnStmt.newTree(value)
elif son.kind == nnkAsgn and son[0].kind == nnkIdent and $son[0] == "result":
node[z] = nnkAsgn.newTree(son[0], nnkCall.newTree(jsResolve, son[1]))
elif son.kind in RoutineNodes:
discard
else:
replaceReturn(son)
inc z

View File

@@ -99,4 +99,9 @@ block asyncPragmaInType:
proc foo() {.async.} = discard
var x: Handler = foo
block: # 13341
proc f {.async.} =
proc g: int =
result = 123
discard main()