summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-03-23 00:33:09 -0700
committerGitHub <noreply@github.com>2021-03-23 08:33:09 +0100
commitd78ebe4a0eadb889255c77f6e375ecec9c706f19 (patch)
tree4757f57d4aff6be0a344b7ecb8a1d5c5af613b62 /lib/core
parentb50776dd2facae166eb9d1bdbcff205c01adc25b (diff)
downloadNim-d78ebe4a0eadb889255c77f6e375ecec9c706f19.tar.gz
fix #17454 (#17461)
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 491235d8b..8b45ed86b 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -1287,7 +1287,15 @@ proc `body=`*(someProc: NimNode, val: NimNode) {.compileTime.} =
   else:
     badNodeKind someProc, "body="
 
-proc basename*(a: NimNode): NimNode {.compileTime, benign.}
+proc basename*(a: NimNode): NimNode {.raises: [].} =
+  ## Pull an identifier from prefix/postfix expressions.
+  case a.kind
+  of nnkIdent: result = a
+  of nnkPostfix, nnkPrefix: result = a[1]
+  of nnkPragmaExpr: result = basename(a[0])
+  else:
+    error("Do not know how to get basename of (" & treeRepr(a) & ")\n" &
+      repr(a), a)
 
 proc `$`*(node: NimNode): string {.compileTime.} =
   ## Get the string of an identifier node.
@@ -1347,16 +1355,6 @@ proc insert*(a: NimNode; pos: int; b: NimNode) {.compileTime.} =
       a[i + 1] = a[i]
     a[pos] = b
 
-proc basename*(a: NimNode): NimNode =
-  ## Pull an identifier from prefix/postfix expressions.
-  case a.kind
-  of nnkIdent: result = a
-  of nnkPostfix, nnkPrefix: result = a[1]
-  of nnkPragmaExpr: result = basename(a[0])
-  else:
-    error("Do not know how to get basename of (" & treeRepr(a) & ")\n" &
-      repr(a), a)
-
 proc `basename=`*(a: NimNode; val: string) {.compileTime.}=
   case a.kind
   of nnkIdent: