From c949b81efdeb08b38224e1678ad140b7b7663b15 Mon Sep 17 00:00:00 2001 From: cooldome Date: Thu, 2 Jan 2020 22:27:37 +0000 Subject: [PATCH] remove default argument for readLines (#12807) [backport] --- compiler/vmops.nim | 2 +- lib/system/io.nim | 6 +++--- tests/vm/tfile_rw.nim | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/vmops.nim b/compiler/vmops.nim index 1e3a258f3111..79c26dd5f322 100644 --- a/compiler/vmops.nim +++ b/compiler/vmops.nim @@ -147,7 +147,7 @@ proc registerAdditionalOps*(c: PCtx) = wrap1s(fileExists, osop) wrapDangerous(writeFile, ioop) wrap1s(readFile, ioop) - wrap2si(readLines, ioop) + wrap2si(staticReadLines, ioop) systemop getCurrentExceptionMsg systemop getCurrentException registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} = diff --git a/lib/system/io.nim b/lib/system/io.nim index ead8deb24676..e961b1bb244e 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -696,10 +696,10 @@ proc writeFile*(filename: string, content: openArray[byte]) {.since: (1, 1).} = else: raise newException(IOError, "cannot open: " & filename) -proc readLines*(filename: string, n = 1.Natural): seq[TaintedString] = - ## read `n` lines from the file named `filename`. Raises an IO exception +proc staticReadLines*(filename: string, n: Natural): seq[TaintedString] = + ## Compile time read `n` lines from the file named `filename`. Raises an IO exception ## in case of an error. Raises EOF if file does not contain at least `n` lines. - ## Available at compile time. A line of text may be delimited by ``LF`` or ``CRLF``. + ## A line of text may be delimited by ``LF`` or ``CRLF``. ## The newline character(s) are not part of the returned strings. var f: File if open(f, filename): diff --git a/tests/vm/tfile_rw.nim b/tests/vm/tfile_rw.nim index 8d7a2ca95ddf..75242794c06e 100644 --- a/tests/vm/tfile_rw.nim +++ b/tests/vm/tfile_rw.nim @@ -13,7 +13,7 @@ static: writeFile(filename, mytext) const myfile_str = staticRead(filename) const myfile_str2 = readFile(filename) -const myfile_str_seq = readLines(filename, 3) +const myfile_str_seq = staticReadLines(filename, 3) static: doAssert myfile_str == mytext