File: miscdollars.nim

package info (click to toggle)
nim 1.4.6%2Breally1.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 936,800 kB
  • sloc: sh: 17,201; ansic: 4,767; makefile: 856; python: 407; sql: 298; asm: 141; xml: 13
file content (15 lines) | stat: -rw-r--r-- 584 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
template toLocation*(result: var string, file: string | cstring, line: int, col: int) =
  ## avoids spurious allocations
  # Hopefully this can be re-used everywhere so that if a user needs to customize,
  # it can be done in a single place.
  result.add file
  if line > 0:
    result.add "("
    # simplify this after moving moving `include strmantle` above import assertions`
    when declared(addInt): result.addInt line
    else: result.add $line
    if col > 0:
      result.add ", "
      when declared(addInt): result.addInt col
      else: result.add $col
    result.add ")"