Less warnings in macros (#10799)

This commit is contained in:
Arne Döring 2019-03-11 19:21:39 +01:00 • committed by Andreas Rumpf
commit 35aab357e2
3 changed files with 34 additions and 24 deletions

View file

@ -1,17 +1,9 @@
# helpers used system.nim and other modules, avoids code duplication while
# also minimizing symbols exposed in system.nim
#
# TODO: move other things here that should not be exposed in system.nim
proc lineInfoToString(file: string, line, column: int): string =
file & "(" & $line & ", " & $column & ")"
# TODO: remove this file. It causes "declared but not used" warnings everywhere.
type InstantiationInfo = tuple[filename: string, line: int, column: int]
proc `$`(info: InstantiationInfo): string =
# The +1 is needed here
# instead of overriding `$` (and changing its meaning), consider explicit name.
lineInfoToString(info.fileName, info.line, info.column+1)
info.fileName & "(" & $info.line & ", " & $(info.column+1) & ")"
proc isNamedTuple(T: type): bool =
## return true for named tuples, false for any other type.