diff options
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim index 80e38ad7b..5dafd6e13 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2407,8 +2407,8 @@ proc astToStr*[T](x: T): string {.magic: "AstToStr", noSideEffect.} ## converts the AST of `x` into a string representation. This is very useful ## for debugging. -proc InstantiationInfo*(index = -1): tuple[filename: string, line: int] {. - magic: "InstantiationInfo", noSideEffect.} +proc InstantiationInfo*(index = -1, fullPaths = false): tuple[ + filename: string, line: int] {. magic: "InstantiationInfo", noSideEffect.} ## provides access to the compiler's instantiation stack line information. ## ## This proc is mostly useful for meta programming (eg. ``assert`` template) @@ -2438,6 +2438,9 @@ proc InstantiationInfo*(index = -1): tuple[filename: string, line: int] {. ## testException(EInvalidIndex, tester(1)) ## # --> Test failure at example.nim:20 with 'tester(1)' +template CurrentSourcePath*: string = InstantiationInfo(-1, true).filename + ## returns the full file-system path of the current source + proc raiseAssert*(msg: string) {.noinline.} = raise newException(EAssertionFailed, msg) |