stdlib and compiler don't use .immediate anymore
This commit is contained in:
parent
9ee5b5eabc
commit
60b187513e
36 changed files with 169 additions and 172 deletions
|
|
@ -338,15 +338,15 @@ proc `<` *[T](x, y: ref T): bool {.magic: "LtPtr", noSideEffect.}
|
|||
proc `<` *[T](x, y: ptr T): bool {.magic: "LtPtr", noSideEffect.}
|
||||
proc `<` *(x, y: pointer): bool {.magic: "LtPtr", noSideEffect.}
|
||||
|
||||
template `!=` * (x, y: expr): expr {.immediate.} =
|
||||
template `!=` * (x, y: untyped): untyped =
|
||||
## unequals operator. This is a shorthand for ``not (x == y)``.
|
||||
not (x == y)
|
||||
|
||||
template `>=` * (x, y: expr): expr {.immediate.} =
|
||||
template `>=` * (x, y: untyped): untyped =
|
||||
## "is greater or equals" operator. This is the same as ``y <= x``.
|
||||
y <= x
|
||||
|
||||
template `>` * (x, y: expr): expr {.immediate.} =
|
||||
template `>` * (x, y: untyped): untyped =
|
||||
## "is greater" operator. This is the same as ``y < x``.
|
||||
y < x
|
||||
|
||||
|
|
@ -1098,13 +1098,13 @@ proc contains*[T](s: Slice[T], value: T): bool {.noSideEffect, inline.} =
|
|||
## assert((1..3).contains(4) == false)
|
||||
result = s.a <= value and value <= s.b
|
||||
|
||||
template `in` * (x, y: expr): expr {.immediate, dirty.} = contains(y, x)
|
||||
template `in` * (x, y: untyped): untyped {.dirty.} = contains(y, x)
|
||||
## Sugar for contains
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## assert(1 in (1..3) == true)
|
||||
## assert(5 in (1..3) == false)
|
||||
template `notin` * (x, y: expr): expr {.immediate, dirty.} = not contains(y, x)
|
||||
template `notin` * (x, y: untyped): untyped {.dirty.} = not contains(y, x)
|
||||
## Sugar for not containing
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
|
|
@ -1123,7 +1123,7 @@ proc `is` *[T, S](x: T, y: S): bool {.magic: "Is", noSideEffect.}
|
|||
##
|
||||
## assert(test[int](3) == 3)
|
||||
## assert(test[string]("xyz") == 0)
|
||||
template `isnot` *(x, y: expr): expr {.immediate.} = not (x is y)
|
||||
template `isnot` *(x, y: untyped): untyped = not (x is y)
|
||||
## Negated version of `is`. Equivalent to ``not(x is y)``.
|
||||
|
||||
proc `of` *[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.}
|
||||
|
|
@ -1742,11 +1742,11 @@ proc swap*[T](a, b: var T) {.magic: "Swap", noSideEffect.}
|
|||
## swaps the values `a` and `b`. This is often more efficient than
|
||||
## ``tmp = a; a = b; b = tmp``. Particularly useful for sorting algorithms.
|
||||
|
||||
template `>=%` *(x, y: expr): expr {.immediate.} = y <=% x
|
||||
template `>=%` *(x, y: untyped): untyped = y <=% x
|
||||
## treats `x` and `y` as unsigned and compares them.
|
||||
## Returns true iff ``unsigned(x) >= unsigned(y)``.
|
||||
|
||||
template `>%` *(x, y: expr): expr {.immediate.} = y <% x
|
||||
template `>%` *(x, y: untyped): untyped = y <% x
|
||||
## treats `x` and `y` as unsigned and compares them.
|
||||
## Returns true iff ``unsigned(x) > unsigned(y)``.
|
||||
|
||||
|
|
@ -1874,7 +1874,7 @@ iterator countdown*[T](a, b: T, step = 1): T {.inline.} =
|
|||
yield res
|
||||
dec(res, step)
|
||||
|
||||
template countupImpl(incr: stmt) {.immediate, dirty.} =
|
||||
template countupImpl(incr: untyped) {.dirty.} =
|
||||
when T is IntLikeForCount:
|
||||
var res = int(a)
|
||||
while res <= int(b):
|
||||
|
|
@ -3181,7 +3181,7 @@ proc `/`*(x, y: int): float {.inline, noSideEffect.} =
|
|||
## integer division that results in a float.
|
||||
result = toFloat(x) / toFloat(y)
|
||||
|
||||
template spliceImpl(s, a, L, b: expr): stmt {.immediate.} =
|
||||
template spliceImpl(s, a, L, b: untyped): untyped =
|
||||
# make room for additional elements or cut:
|
||||
var slen = s.len
|
||||
var shift = b.len - L
|
||||
|
|
@ -3467,7 +3467,7 @@ iterator mitems*(a: var string): var char {.inline.} =
|
|||
when not defined(nimhygiene):
|
||||
{.pragma: inject.}
|
||||
|
||||
template onFailedAssert*(msg: expr, code: stmt): stmt {.dirty, immediate.} =
|
||||
template onFailedAssert*(msg, code: untyped): untyped {.dirty.} =
|
||||
## Sets an assertion failure handler that will intercept any assert
|
||||
## statements following `onFailedAssert` in the current module scope.
|
||||
##
|
||||
|
|
@ -3480,7 +3480,7 @@ template onFailedAssert*(msg: expr, code: stmt): stmt {.dirty, immediate.} =
|
|||
## e.lineinfo = instantiationInfo(-2)
|
||||
## raise e
|
||||
##
|
||||
template failedAssertImpl(msgIMPL: string): stmt {.dirty.} =
|
||||
template failedAssertImpl(msgIMPL: string): untyped {.dirty.} =
|
||||
let msg = msgIMPL
|
||||
code
|
||||
|
||||
|
|
@ -3643,7 +3643,7 @@ proc `==` *(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
|
|||
elif x.isNil or y.isNil: result = false
|
||||
else: result = strcmp(x, y) == 0
|
||||
|
||||
template closureScope*(body: untyped): stmt =
|
||||
template closureScope*(body: untyped): untyped =
|
||||
## Useful when creating a closure in a loop to capture local loop variables by
|
||||
## their current iteration values. Example:
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue