Use a unique name for template in async macro return (#21058)
Use unique template name
This commit is contained in:
parent
db56fc3bcb
commit
f330b33e2b
1 changed files with 3 additions and 3 deletions
|
|
@ -218,13 +218,13 @@ proc asyncSingleProc(prc: NimNode): NimNode =
|
||||||
procBody = newStmtList()
|
procBody = newStmtList()
|
||||||
let resultIdent = ident"result"
|
let resultIdent = ident"result"
|
||||||
procBody.add quote do:
|
procBody.add quote do:
|
||||||
template setResult(x: `subRetType`) {.used.} =
|
template nimAsyncDispatchSetResult(x: `subRetType`) {.used.} =
|
||||||
# If the proc has implicit return then this will get called
|
# If the proc has implicit return then this will get called
|
||||||
`resultIdent` = x
|
`resultIdent` = x
|
||||||
template setResult(x: untyped) {.used.} =
|
template nimAsyncDispatchSetResult(x: untyped) {.used.} =
|
||||||
# If the proc doesn't have implicit return then this will get called
|
# If the proc doesn't have implicit return then this will get called
|
||||||
x
|
x
|
||||||
procBody.add newCall(ident"setResult", blockStmt)
|
procBody.add newCall(ident"nimAsyncDispatchSetResult", blockStmt)
|
||||||
procBody.add(createFutureVarCompletions(futureVarIdents, nil))
|
procBody.add(createFutureVarCompletions(futureVarIdents, nil))
|
||||||
procBody.insert(0): quote do:
|
procBody.insert(0): quote do:
|
||||||
{.push warning[resultshadowed]: off.}
|
{.push warning[resultshadowed]: off.}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue