mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 22:43:34 +00:00
Fixed yield in nkCheckedFieldExpr (#12429) [backport]
This commit is contained in:
committed by
Andreas Rumpf
parent
48975bb3e7
commit
1aed455e7c
@@ -683,7 +683,8 @@ proc lowerStmtListExprs(ctx: var Ctx, n: PNode, needsSplit: var bool): PNode =
|
||||
n[0] = ex
|
||||
result.add(n)
|
||||
|
||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv, nkObjDownConv:
|
||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv, nkObjDownConv,
|
||||
nkDerefExpr, nkHiddenDeref:
|
||||
var ns = false
|
||||
for i in 0 ..< n.len:
|
||||
n[i] = ctx.lowerStmtListExprs(n[i], ns)
|
||||
@@ -757,7 +758,7 @@ proc lowerStmtListExprs(ctx: var Ctx, n: PNode, needsSplit: var bool): PNode =
|
||||
n[0] = newSymNode(ctx.g.getSysSym(n[0].info, "true"))
|
||||
n[1] = newBody
|
||||
|
||||
of nkDotExpr:
|
||||
of nkDotExpr, nkCheckedFieldExpr:
|
||||
var ns = false
|
||||
n[0] = ctx.lowerStmtListExprs(n[0], ns)
|
||||
if ns:
|
||||
|
||||
@@ -43,4 +43,14 @@ block: #8399
|
||||
|
||||
waitFor foo("$asd")
|
||||
|
||||
block: # nkCheckedFieldExpr
|
||||
proc bar(): Future[JsonNode] {.async.} =
|
||||
return newJInt(5)
|
||||
|
||||
proc foo() {.async.} =
|
||||
let n = 10 + (await bar()).num
|
||||
doAssert(n == 15)
|
||||
|
||||
waitFor foo()
|
||||
|
||||
echo "ok"
|
||||
|
||||
Reference in New Issue
Block a user