diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-08 22:24:28 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-07-08 22:24:28 +0200 |
commit | e2267ef5c95e400e20ac48bea9c662241bc01f18 (patch) | |
tree | 7f3dec1d840266b55e27853ac38b83d6add91d18 /lib | |
parent | 089c31765fd7d0fc2c4beb4869dd9a42c78b4ab8 (diff) | |
download | Nim-e2267ef5c95e400e20ac48bea9c662241bc01f18.tar.gz |
Nimscript supports hint() and warning() procs; refs #3688
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/nimscript.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index d587d772f..db6d72d7b 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -39,6 +39,9 @@ proc getCurrentDir(): string = builtin proc rawExec(cmd: string): int {.tags: [ExecIOEffect], raises: [OSError].} = builtin +proc warningImpl(arg, orig: string) = discard +proc hintImpl(arg, orig: string) = discard + proc paramStr*(i: int): string = ## Retrieves the ``i``'th command line parameter. builtin @@ -52,6 +55,16 @@ proc switch*(key: string, val="") = ## example ``switch("checks", "on")``. builtin +proc warning*(name: string; val: bool) = + ## Disables or enables a specific warning. + let v = if val: "on" else: "off" + warningImpl(name & "]:" & v, "warning[" & name & "]:" & v) + +proc hint*(name: string; val: bool) = + ## Disables or enables a specific hint. + let v = if val: "on" else: "off" + hintImpl(name & "]:" & v, "hint[" & name & "]:" & v) + proc getCommand*(): string = ## Gets the Nim command that the compiler has been invoked with, for example ## "c", "js", "build", "help". |