fix js stacktraces, unify all file,line,col formatting into a single function (#14230)
* fix https://github.com/timotheecour/Nim/issues/135 ; unify all file,line,col formatting into a single function
This commit is contained in:
parent
6b7b5fb4fa
commit
c28a057a6b
7 changed files with 68 additions and 46 deletions
|
|
@ -1,17 +1,17 @@
|
|||
when not declared(sysFatal):
|
||||
include "system/fatal"
|
||||
|
||||
import std/private/miscdollars
|
||||
# ---------------------------------------------------------------------------
|
||||
# helpers
|
||||
|
||||
type InstantiationInfo = tuple[filename: string, line: int, column: int]
|
||||
|
||||
proc `$`(x: int): string {.magic: "IntToStr", noSideEffect.}
|
||||
|
||||
proc `$`(info: InstantiationInfo): string =
|
||||
# The +1 is needed here
|
||||
# instead of overriding `$` (and changing its meaning), consider explicit name.
|
||||
info.filename & "(" & $info.line & ", " & $(info.column+1) & ")"
|
||||
result.toLocation(info.filename, info.line, info.column+1)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue