diff options
author | Anatoly Galiulin <galiulin.anatoly@gmail.com> | 2016-03-31 16:45:54 +0600 |
---|---|---|
committer | Anatoly Galiulin <galiulin.anatoly@gmail.com> | 2016-03-31 16:47:55 +0600 |
commit | a9330391c34aa941e895a33a909b2f08ba59f60b (patch) | |
tree | bae0d9acdc1caf199afe20717127081b90e67341 | |
parent | 45bbecb0211d18b425c7736f803dde2acef79311 (diff) | |
download | Nim-a9330391c34aa941e895a33a909b2f08ba59f60b.tar.gz |
Move ``compiles`` back
-rw-r--r-- | lib/system.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/system.nim b/lib/system.nim index bcb55fe48..56210f5dc 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2561,16 +2561,6 @@ else: if x < 0: -x else: x {.pop.} -proc compiles*(x: expr): bool {.magic: "Compiles", noSideEffect, compileTime.} = - ## Special compile-time procedure that checks whether `x` can be compiled - ## without any semantic error. - ## This can be used to check whether a type supports some operation: - ## - ## .. code-block:: Nim - ## when not compiles(3 + 4): - ## echo "'+' for integers is available" - discard - when not defined(JS): #and not defined(nimscript): {.push stack_trace: off, profiler:off.} @@ -3480,6 +3470,16 @@ when hasAlloc: x[j+i] = item[j] inc(j) +proc compiles*(x: expr): bool {.magic: "Compiles", noSideEffect, compileTime.} = + ## Special compile-time procedure that checks whether `x` can be compiled + ## without any semantic error. + ## This can be used to check whether a type supports some operation: + ## + ## .. code-block:: Nim + ## when not compiles(3 + 4): + ## echo "'+' for integers is available" + discard + when declared(initDebugger): initDebugger() |