diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-04-21 08:13:37 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-21 08:13:37 +0200 |
commit | 33b69f0ed0272a4792322d9a0fbaffd5bef2f6e9 (patch) | |
tree | f7d38c41d242024ea644cd855fa9b71eee7e8bd2 /compiler/ast.nim | |
parent | 6667362c2f1cd0fc1fdb1dacb486528b928470d5 (diff) | |
download | Nim-33b69f0ed0272a4792322d9a0fbaffd5bef2f6e9.tar.gz |
refactoring: make FileIndex a distinct type; make line information an uint16; fixes #7654
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index da7e828f2..4a0a9a20b 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1042,9 +1042,9 @@ proc newNode*(kind: TNodeKind): PNode = new(result) result.kind = kind #result.info = UnknownLineInfo() inlined: - result.info.fileIndex = int32(-1) + result.info.fileIndex = InvalidFileIdx result.info.col = int16(-1) - result.info.line = int16(-1) + result.info.line = uint16(0) when defined(useNodeIds): result.id = gNodeId if result.id == nodeIdToDebug: @@ -1116,13 +1116,13 @@ proc linkTo*(s: PSym, t: PType): PSym {.discardable.} = s.typ = t result = s -template fileIdx*(c: PSym): int32 = +template fileIdx*(c: PSym): FileIndex = # XXX: this should be used only on module symbols - c.position.int32 + c.position.FileIndex template filename*(c: PSym): string = # XXX: this should be used only on module symbols - c.position.int32.toFilename + c.position.FileIndex.toFilename proc appendToModule*(m: PSym, n: PNode) = ## The compiler will use this internally to add nodes that will be |