remove {.compileTime.} for procs with NimNode: redundant because of tfTriggersCompileTime (#17463)

This commit is contained in:
Timothee Cour 2021-03-23 02:51:21 -07:00 • committed by GitHub
commit c27cd83265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 112 deletions

View file

@ -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:

View file

@ -56,7 +56,7 @@ const
ariaAttr* = " role " ## HTML DOM Aria Attributes
commonAttr* = coreAttr & eventAttr & ariaAttr ## HTML DOM Common Attributes
proc getIdent(e: NimNode): string {.compileTime.} =
proc getIdent(e: NimNode): string =
case e.kind
of nnkIdent:
result = e.strVal.normalize
@ -75,7 +75,7 @@ proc delete[T](s: var seq[T], attr: T): bool =
result = true
proc xmlCheckedTag*(argsList: NimNode, tag: string, optAttr = "", reqAttr = "",
isLeaf = false): NimNode {.compileTime.} =
isLeaf = false): NimNode =
## use this procedure to define a new XML tag
# copy the attributes; when iterating over them these lists

View file

@ -398,7 +398,7 @@ proc `%`*(o: enum): JsonNode =
## string. Creates a new `JString JsonNode`.
result = %($o)
proc toJsonImpl(x: NimNode): NimNode {.compileTime.} =
proc toJsonImpl(x: NimNode): NimNode =
case x.kind
of nnkBracket: # array
if x.len == 0: return newCall(bindSym"newJArray")
@ -1169,7 +1169,7 @@ when defined(nimFixedForwardGeneric):
if typeExpr.kind == nnkTupleConstr:
error("Use a named tuple instead of: " & typeExpr.repr, lineinfoNode)
proc foldObjectBody(dst, typeNode, tmpSym, jsonNode, jsonPath, originalJsonPathLen: NimNode): void {.compileTime.} =
proc foldObjectBody(dst, typeNode, tmpSym, jsonNode, jsonPath, originalJsonPathLen: NimNode) =
case typeNode.kind
of nnkEmpty:
discard

View file

@ -19,7 +19,7 @@ proc checkPragma(ex, prag: var NimNode) =
prag = ex[1]
ex = ex[0]
proc createProcType(p, b: NimNode): NimNode {.compileTime.} =
proc createProcType(p, b: NimNode): NimNode =
result = newNimNode(nnkProcTy)
var
formalParams = newNimNode(nnkFormalParams).add(b)

View file

@ -744,7 +744,7 @@ proc findAll*(n: XmlNode, tag: string, caseInsensitive = false): seq[XmlNode] =
newSeq(result, 0)
findAll(n, tag, result, caseInsensitive)
proc xmlConstructor(a: NimNode): NimNode {.compileTime.} =
proc xmlConstructor(a: NimNode): NimNode =
if a.kind == nnkCall:
result = newCall("newXmlTree", toStrLit(a[0]))
var attrs = newNimNode(nnkBracket, a)