diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-03-05 14:36:40 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-03-05 15:12:11 +0100 |
commit | d3ce5f34f8e763884009b6dd3d4609d4a8071ff8 (patch) | |
tree | edee9516e16daae225e38cf8f4f1b5dc854b5f68 /lib | |
parent | 267a2756e4b6abc4415af51288b5ae0fab60eef3 (diff) | |
download | Nim-d3ce5f34f8e763884009b6dd3d4609d4a8071ff8.tar.gz |
fixes #3767
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim index 904791a46..b2525c336 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -3541,16 +3541,22 @@ proc `^`*(x: int): int {.noSideEffect, magic: "Roof".} = ## overloaded ``[]`` or ``[]=`` accessors. discard -template `..^`*(a, b: expr): expr = +template `..^`*(a, b: untyped): untyped = ## a shortcut for '.. ^' to avoid the common gotcha that a space between ## '..' and '^' is required. a .. ^b -template `..<`*(a, b: expr): expr = +template `..<`*(a, b: untyped): untyped {.dirty.} = ## a shortcut for '.. <' to avoid the common gotcha that a space between ## '..' and '<' is required. a .. <b +iterator `..<`*[S,T](a: S, b: T): T = + var i = T(a) + while i < b: + yield i + inc i + proc xlen*(x: string): int {.magic: "XLenStr", noSideEffect.} = discard proc xlen*[T](x: seq[T]): int {.magic: "XLenSeq", noSideEffect.} = ## returns the length of a sequence or a string without testing for 'nil'. |