summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/impure/re.nim5
-rwxr-xr-xlib/pure/pegs.nim5
-rwxr-xr-xlib/system.nim5
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim
index 7ef3d247a..57dc3a313 100755
--- a/lib/impure/re.nim
+++ b/lib/impure/re.nim
@@ -218,6 +218,9 @@ proc findAll*(s: string, pattern: TRegEx, start = 0): seq[string] =
   ## If it does not match, @[] is returned.
   accumulateResult(findAll(s, pattern, start))
 
+when not defined(nimhygiene):
+  {.pragma: inject.}
+
 template `=~` *(s: string, pattern: TRegEx): expr = 
   ## This calls ``match`` with an implicit declared ``matches`` array that 
   ## can be used in the scope of the ``=~`` call: 
@@ -237,7 +240,7 @@ template `=~` *(s: string, pattern: TRegEx): expr =
   ##     echo("syntax error")
   ##
   when not definedInScope(matches):
-    var matches: array[0..re.maxSubPatterns-1, string]
+    var matches {.inject.}: array[0..re.maxSubPatterns-1, string]
   match(s, pattern, matches)
 
 # ------------------------- more string handling ------------------------------
diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim
index efa77199b..e37c072f1 100755
--- a/lib/pure/pegs.nim
+++ b/lib/pure/pegs.nim
@@ -845,6 +845,9 @@ proc findAll*(s: string, pattern: TPeg, start = 0): seq[string] {.
   ## returns all matching *substrings* of `s` that match `pattern`.
   ## If it does not match, @[] is returned.
   accumulateResult(findAll(s, pattern, start))
+
+when not defined(nimhygiene):
+  {.pragma: inject.}
   
 template `=~`*(s: string, pattern: TPeg): bool =
   ## This calls ``match`` with an implicit declared ``matches`` array that 
@@ -865,7 +868,7 @@ template `=~`*(s: string, pattern: TPeg): bool =
   ##     echo("syntax error")
   ##  
   when not definedInScope(matches):
-    var matches: array[0..pegs.maxSubpatterns-1, string]
+    var matches {.inject.}: array[0..pegs.maxSubpatterns-1, string]
   match(s, pattern, matches)
 
 # ------------------------- more string handling ------------------------------
diff --git a/lib/system.nim b/lib/system.nim
index 2d2de8e98..6d1f14e2e 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2290,6 +2290,9 @@ template doAssert*(cond: bool, msg = "") =
     if not cond:
       raiseAssert(astToStr(cond) & ' ' & msg)
 
+when not defined(nimhygiene):
+  {.pragma: inject.}
+
 template onFailedAssert*(msg: expr, code: stmt): stmt =
   ## Sets an assertion failure handler that will intercept any assert statements
   ## following `onFailedAssert` in the current lexical scope.
@@ -2310,7 +2313,7 @@ template onFailedAssert*(msg: expr, code: stmt): stmt =
   ##     assert(...)
   ##
   template raiseAssert(msgIMPL: string): stmt =
-    let `msg` = msgIMPL
+    let msg {.inject.} = msgIMPL
     code
 
 proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} =