summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-09-22 14:56:40 +0300
committerGitHub <noreply@github.com>2024-09-22 13:56:40 +0200
commit7da2ffb7513192ccfd29f62eed613298b3a6f6f4 (patch)
treef8cb79b1af4400eb89ce722860645ef31e780d2d /compiler
parent5c843d3d60982bb0669107ee67863737f52574ba (diff)
downloadNim-7da2ffb7513192ccfd29f62eed613298b3a6f6f4.tar.gz
fix custom pragma with backticks not working [backport] (#24151)
refs https://forum.nim-lang.org/t/12522
Diffstat (limited to 'compiler')
-rw-r--r--compiler/pragmas.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 78b6728d5..c4be1223b 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -800,13 +800,14 @@ proc pragmaGuard(c: PContext; it: PNode; kind: TSymKind): PSym =
 proc semCustomPragma(c: PContext, n: PNode, sym: PSym): PNode =
   var callNode: PNode
 
-  if n.kind in {nkIdent, nkSym}:
+  case n.kind
+  of nkIdentKinds:
     # pragma -> pragma()
     callNode = newTree(nkCall, n)
-  elif n.kind == nkExprColonExpr:
+  of nkExprColonExpr:
     # pragma: arg -> pragma(arg)
     callNode = newTree(nkCall, n[0], n[1])
-  elif n.kind in nkPragmaCallKinds:
+  of nkPragmaCallKinds - {nkExprColonExpr}:
     callNode = n
   else:
     invalidPragma(c, n)