mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
added 'since' template for further stdlib additions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user