diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-11-07 12:02:26 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-11-07 14:20:39 +0100 |
commit | 372b01711e2a4d3f0672f75aaa0895147b928cfc (patch) | |
tree | cc6c0eb9631aabe37f432119aff69c7dd47543ad /lib/system | |
parent | f69ee294c8451c10b6d8159b74c5248980261431 (diff) | |
download | Nim-372b01711e2a4d3f0672f75aaa0895147b928cfc.tar.gz |
added 'since' template for further stdlib additions
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/inclrtl.nim | 4 | ||||
-rw-r--r-- | lib/system/io.nim | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/inclrtl.nim b/lib/system/inclrtl.nim index 4193f2bdd..6bff819e6 100644 --- a/lib/system/inclrtl.nim +++ b/lib/system/inclrtl.nim @@ -48,3 +48,7 @@ when defined(nimlocks): {.pragma: benign, gcsafe, locks: 0.} else: {.pragma: benign, gcsafe.} + +template since(version, body: untyped) {.dirty.} = + when version <= (NimMajor, NimMinor): + body diff --git a/lib/system/io.nim b/lib/system/io.nim index fcdfa79c0..7010a7fdb 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -685,7 +685,7 @@ proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.} = else: sysFatal(IOError, "cannot open: " & filename) -proc writeFile*(filename: string, content: openArray[byte]) = +proc writeFile*(filename: string, content: openArray[byte]) {.since: (1, 1).} = ## Opens a file named `filename` for writing. Then writes the ## `content` completely to the file and closes the file afterwards. ## Raises an IO exception in case of an error. |