summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-11-20 00:53:25 +0800
committerGitHub <noreply@github.com>2023-11-19 17:53:25 +0100
commitcecaf9c56b1240a44a4de837e03694a0c55ec379 (patch)
treebe4434e4aaad0ea631d4093454b04128d6dab087 /compiler
parent5dafcf4957a225b1f015d131299e51735e7bb1d3 (diff)
downloadNim-cecaf9c56b1240a44a4de837e03694a0c55ec379.tar.gz
fixes #22939; fixes #16890; push should but doesn't apply to importc … (#22944)
…var/let symbols


fixes #22939
fixes #16890

Besides, it was applied to let/const/var with pragmas, now it is
universally applied.

```nim
{.push exportc.}
proc foo =
  let bar = 12
  echo bar
{.pop.}
```

For example, the `bar` variable will be affected by `exportc`.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 65eaf1a89..0a0050f2f 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -528,6 +528,12 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
     else: discard
   else:
     result = semIdentVis(c, kind, n, allowed)
+    case kind
+    of skField: implicitPragmas(c, result, n.info, fieldPragmas)
+    of skVar:   implicitPragmas(c, result, n.info, varPragmas)
+    of skLet:   implicitPragmas(c, result, n.info, letPragmas)
+    of skConst: implicitPragmas(c, result, n.info, constPragmas)
+    else: discard
 
 proc checkForOverlap(c: PContext, t: PNode, currentEx, branchIndex: int) =
   let ex = t[branchIndex][currentEx].skipConv