summary refs log tree commit diff stats
path: root/compiler/ast.nim
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2022-10-03 07:07:55 +0300
committerGitHub <noreply@github.com>2022-10-03 06:07:55 +0200
commit2cca38d33c50650d1606c6ec09c73af6b8b0c3c8 (patch)
treeb4c3053dc221b84fa576efff2f04d41f48bbf148 /compiler/ast.nim
parent81e7811e01b22518cb5e533cf75ed5dda0873415 (diff)
downloadNim-2cca38d33c50650d1606c6ec09c73af6b8b0c3c8.tar.gz
pragma for sfCallsite instead of name check + better semantics, test (#20464)
* pragma for sfCallsite instead of name check at every template definition

Not documented because it seems to be for internal use?

Should also make it possible to make comparisons and setops imports, but this doesn't have to be done.

I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe.

* make sfCallsite recursive, add tests
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r--compiler/ast.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index e1d982a43..4174e7f34 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -1254,6 +1254,12 @@ proc skipPragmaExpr*(n: PNode): PNode =
   else:
     result = n
 
+proc setInfoRecursive*(n: PNode, info: TLineInfo) =
+  ## set line info recursively
+  if n != nil:
+    for i in 0..<n.safeLen: setInfoRecursive(n[i], info)
+    n.info = info
+
 when defined(useNodeIds):
   const nodeIdToDebug* = -1 # 2322968
   var gNodeId: int