summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2020-08-11 22:28:49 +0200
committerGitHub <noreply@github.com>2020-08-11 22:28:49 +0200
commit2cea52ee7e7d0f118976df5311a84540cbea85cd (patch)
tree0f0fa5aea4a46c3ae74aab774eac568826ca229c /tests/template
parent813f16a2a39f1375b241cf50845f641ea44d890e (diff)
downloadNim-2cea52ee7e7d0f118976df5311a84540cbea85cd.tar.gz
Allow pragmas on parameters (#15178)
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/tparams_gensymed.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/template/tparams_gensymed.nim b/tests/template/tparams_gensymed.nim
index cfd354a74..2a1fda41a 100644
--- a/tests/template/tparams_gensymed.nim
+++ b/tests/template/tparams_gensymed.nim
@@ -15,6 +15,7 @@ wth
 0
 (total: 6)
 S1
+5
 '''
 """
 # bug #1915
@@ -321,3 +322,17 @@ block: #Gensymmed sym sharing forward decl
       newProc(sym, body = newStmtList()),
     )
   genGenMacro
+
+# inject pragma on params
+
+template test(procname, body: untyped): untyped = 
+  proc procname(data {.inject.}: var int = 0) =
+    body
+
+test(hello):
+  echo data
+  data = 3
+
+var data = 5
+
+hello(data)