move since from inclrtl to std/private/since (#14188)
* move since from inclrtl to std/private/since * move since import in system below for HCR
This commit is contained in:
parent
3be669be32
commit
fbc97e712a
27 changed files with 60 additions and 59 deletions
|
|
@ -1,4 +1,4 @@
|
|||
include system/inclrtl
|
||||
import std/private/since
|
||||
|
||||
proc `$`*(x: int): string {.magic: "IntToStr", noSideEffect.}
|
||||
## The stringify operator for an integer argument. Returns `x`
|
||||
|
|
|
|||
|
|
@ -48,21 +48,3 @@ when defined(nimlocks):
|
|||
{.pragma: benign, gcsafe, locks: 0.}
|
||||
else:
|
||||
{.pragma: benign, gcsafe.}
|
||||
|
||||
template isSince(version: (int, int)): bool =
|
||||
(NimMajor, NimMinor) >= version
|
||||
template isSince(version: (int, int, int)): bool =
|
||||
(NimMajor, NimMinor, NimPatch) >= version
|
||||
|
||||
template since(version, body: untyped) {.dirty, used.} =
|
||||
## Usage:
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## proc fun*() {since: (1, 3).}
|
||||
## proc fun*() {since: (1, 3, 1).}
|
||||
##
|
||||
## Limitation: can't be used to annotate a template (eg typetraits.get), would
|
||||
## error: cannot attach a custom pragma.
|
||||
# `dirty` needed because `NimMajor` may not yet be defined in caller.
|
||||
when isSince(version):
|
||||
body
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
|
||||
include inclrtl
|
||||
import std/private/since
|
||||
import formatfloat
|
||||
|
||||
# ----------------- IO Part ------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue