parent
ffccdf3c1a
commit
7fc0c3dfbf
1 changed files with 8 additions and 3 deletions
|
|
@ -11,6 +11,13 @@
|
||||||
|
|
||||||
import macros, strutils, asyncfutures
|
import macros, strutils, asyncfutures
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Ref https://github.com/nim-lang/Nim/issues/5617
|
||||||
|
# TODO: Add more line infos
|
||||||
|
proc newCallWithLineInfo(fromNode: NimNode; theProc: NimNode, args: varargs[NimNode]): NimNode =
|
||||||
|
result = newCall(theProc, args)
|
||||||
|
result.copyLineInfo(fromNode)
|
||||||
|
|
||||||
template createCb(retFutureSym, iteratorNameSym,
|
template createCb(retFutureSym, iteratorNameSym,
|
||||||
strName, identName, futureVarCompletions: untyped) =
|
strName, identName, futureVarCompletions: untyped) =
|
||||||
bind finished
|
bind finished
|
||||||
|
|
@ -52,15 +59,13 @@ proc createFutureVarCompletions(futureVarIdents: seq[NimNode],
|
||||||
# Add calls to complete each FutureVar parameter.
|
# Add calls to complete each FutureVar parameter.
|
||||||
for ident in futureVarIdents:
|
for ident in futureVarIdents:
|
||||||
# Only complete them if they have not been completed already by the user.
|
# Only complete them if they have not been completed already by the user.
|
||||||
# TODO: Once https://github.com/nim-lang/Nim/issues/5617 is fixed.
|
|
||||||
# TODO: Add line info to the complete() call!
|
|
||||||
# In the meantime, this was really useful for debugging :)
|
# In the meantime, this was really useful for debugging :)
|
||||||
#result.add(newCall(newIdentNode("echo"), newStrLitNode(fromNode.lineinfo)))
|
#result.add(newCall(newIdentNode("echo"), newStrLitNode(fromNode.lineinfo)))
|
||||||
result.add newIfStmt(
|
result.add newIfStmt(
|
||||||
(
|
(
|
||||||
newCall(newIdentNode("not"),
|
newCall(newIdentNode("not"),
|
||||||
newDotExpr(ident, newIdentNode("finished"))),
|
newDotExpr(ident, newIdentNode("finished"))),
|
||||||
newCall(newIdentNode("complete"), ident)
|
newCallWithLineInfo(fromNode, newIdentNode("complete"), ident)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue