remove {.compileTime.} for procs with NimNode: redundant because of tfTriggersCompileTime (#17463)
This commit is contained in:
parent
c719d79d23
commit
c27cd83265
6 changed files with 106 additions and 112 deletions
|
|
@ -53,8 +53,7 @@ template createCb(retFutureSym, iteratorNameSym,
|
|||
retFutureSym.fail(getCurrentException())
|
||||
identName()
|
||||
|
||||
proc createFutureVarCompletions(futureVarIdents: seq[NimNode],
|
||||
fromNode: NimNode): NimNode {.compileTime.} =
|
||||
proc createFutureVarCompletions(futureVarIdents: seq[NimNode], fromNode: NimNode): NimNode =
|
||||
result = newNimNode(nnkStmtList, fromNode)
|
||||
# Add calls to complete each FutureVar parameter.
|
||||
for ident in futureVarIdents:
|
||||
|
|
@ -71,7 +70,7 @@ proc createFutureVarCompletions(futureVarIdents: seq[NimNode],
|
|||
|
||||
proc processBody(node, retFutureSym: NimNode,
|
||||
subTypeIsVoid: bool,
|
||||
futureVarIdents: seq[NimNode]): NimNode {.compileTime.} =
|
||||
futureVarIdents: seq[NimNode]): NimNode =
|
||||
#echo(node.treeRepr)
|
||||
result = node
|
||||
case node.kind
|
||||
|
|
@ -107,7 +106,7 @@ proc processBody(node, retFutureSym: NimNode,
|
|||
|
||||
# echo result.repr
|
||||
|
||||
proc getName(node: NimNode): string {.compileTime.} =
|
||||
proc getName(node: NimNode): string =
|
||||
case node.kind
|
||||
of nnkPostfix:
|
||||
return node[1].strVal
|
||||
|
|
@ -118,7 +117,7 @@ proc getName(node: NimNode): string {.compileTime.} =
|
|||
else:
|
||||
error("Unknown name.", node)
|
||||
|
||||
proc getFutureVarIdents(params: NimNode): seq[NimNode] {.compileTime.} =
|
||||
proc getFutureVarIdents(params: NimNode): seq[NimNode] =
|
||||
result = @[]
|
||||
for i in 1 ..< len(params):
|
||||
expectKind(params[i], nnkIdentDefs)
|
||||
|
|
@ -130,7 +129,7 @@ proc getFutureVarIdents(params: NimNode): seq[NimNode] {.compileTime.} =
|
|||
proc isInvalidReturnType(typeName: string): bool =
|
||||
return typeName notin ["Future"] #, "FutureStream"]
|
||||
|
||||
proc verifyReturnType(typeName: string, node: NimNode = nil) {.compileTime.} =
|
||||
proc verifyReturnType(typeName: string, node: NimNode = nil) =
|
||||
if typeName.isInvalidReturnType:
|
||||
error("Expected return type of 'Future' got '$1'" %
|
||||
typeName, node)
|
||||
|
|
@ -144,7 +143,7 @@ template await*[T](f: Future[T]): auto {.used.} =
|
|||
yield internalTmpFuture
|
||||
(cast[typeof(f)](internalTmpFuture)).read()
|
||||
|
||||
proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||
proc asyncSingleProc(prc: NimNode): NimNode =
|
||||
## This macro transforms a single procedure into a closure iterator.
|
||||
## The `async` macro supports a stmtList holding multiple async procedures.
|
||||
if prc.kind == nnkProcTy:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue