diff options
author | hlaaftana <10591326+hlaaftana@users.noreply.github.com> | 2020-05-03 00:51:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 23:51:59 +0200 |
commit | fbc97e712a67f30076f7633880383c8c4ae7866f (patch) | |
tree | 3eec30d015360011fdfbb9ef71cfc85b172c3d67 /lib/std/private | |
parent | 3be669be3255c6b47dd2542af9d2055a7d1207e3 (diff) | |
download | Nim-fbc97e712a67f30076f7633880383c8c4ae7866f.tar.gz |
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
Diffstat (limited to 'lib/std/private')
-rw-r--r-- | lib/std/private/since.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/std/private/since.nim b/lib/std/private/since.nim new file mode 100644 index 000000000..e4aecb61a --- /dev/null +++ b/lib/std/private/since.nim @@ -0,0 +1,19 @@ +template since*(version: (int, int), body: untyped) {.dirty.} = + ## Evaluates `body` if the ``(NimMajor, NimMinor)`` is greater than + ## or equal to `version`. Usage: + ## + ## .. code-block:: Nim + ## proc fun*() {.since: (1, 3).} + ## since (1, 3): fun() + when (NimMajor, NimMinor) >= version: + body + +template since*(version: (int, int, int), body: untyped) {.dirty.} = + ## Evaluates `body` if ``(NimMajor, NimMinor, NimPatch)`` is greater than + ## or equal to `version`. Usage: + ## + ## .. code-block:: Nim + ## proc fun*() {.since: (1, 3, 1).} + ## since (1, 3, 1): fun() + when (NimMajor, NimMinor, NimPatch) >= version: + body \ No newline at end of file |