summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-07-18 01:49:36 -0700
committerGitHub <noreply@github.com>2020-07-18 10:49:36 +0200
commit169ca37d2628312b5d94d5e90c3271179db87a13 (patch)
tree7f5e0a9dc8d4325bdd58eb2a8fb6ba21b671ae41 /lib/core
parentc983466c15f1807c66f4c2f07ba348b0f95584b3 (diff)
downloadNim-169ca37d2628312b5d94d5e90c3271179db87a13.tar.gz
enable,document,test getImplTransformed, very useful for understanding how nim transforms code (#14924)
* enable,document,test getImplTransformed, very useful for understanding how nim transforms code
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 7b03d4e4d..e4a56d6f9 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -277,9 +277,12 @@ else: # bootstrapping substitute
 
 {.pop.}
 
-when defined(nimSymImplTransform):
+when (NimMajor, NimMinor, NimPatch) >= (1, 3, 5) or defined(nimSymImplTransform):
   proc getImplTransformed*(symbol: NimNode): NimNode {.magic: "GetImplTransf", noSideEffect.}
-    ## For a typed proc returns the AST after transformation pass.
+    ## For a typed proc returns the AST after transformation pass; this is useful
+    ## for debugging how the compiler transforms code (eg: `defer`, `for`) but
+    ## note that code transformations are implementation dependent and subject to change.
+    ## See an example in `tests/macros/tmacros_various.nim`.
 
 when defined(nimHasSymOwnerInMacro):
   proc owner*(sym: NimNode): NimNode {.magic: "SymOwner", noSideEffect.}
sion' href='/ahoang/Nim/blame/changelog.md?h=devel&id=c0433b0b6cd42c279cd2c259eb45636670db1fc7'>^
b14cc1e3b ^


d52a1061b ^

d7a896f19 ^


90c1b94fb ^

560d87f5f ^
90c1b94fb ^
9565da11e ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39