Lineinfo change (#6084)
This commit is contained in:
parent
9427724a71
commit
52f092d02b
9 changed files with 53 additions and 12 deletions
|
|
@ -746,7 +746,7 @@ proc toFileLine*(info: TLineInfo): string {.inline.} =
|
|||
result = info.toFilename & ":" & $info.line
|
||||
|
||||
proc toFileLineCol*(info: TLineInfo): string {.inline.} =
|
||||
result = info.toFilename & "(" & $info.line & "," & $info.col & ")"
|
||||
result = info.toFilename & "(" & $info.line & ", " & $info.col & ")"
|
||||
|
||||
proc `$`*(info: TLineInfo): string = toFileLineCol(info)
|
||||
|
||||
|
|
|
|||
|
|
@ -1307,12 +1307,24 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
|||
ensureKind(rkNode)
|
||||
if c.callsite != nil: regs[ra].node = c.callsite
|
||||
else: stackTrace(c, tos, pc, errFieldXNotFound, "callsite")
|
||||
of opcNLineInfo:
|
||||
of opcNGetFile:
|
||||
decodeB(rkNode)
|
||||
let n = regs[rb].node
|
||||
createStr regs[ra]
|
||||
regs[ra].node.strVal = n.info.toFileLineCol
|
||||
regs[ra].node.info = c.debug[pc]
|
||||
regs[ra].node = newStrNode(nkStrLit, n.info.toFilename)
|
||||
regs[ra].node.info = n.info
|
||||
regs[ra].node.typ = n.typ
|
||||
of opcNGetLine:
|
||||
decodeB(rkNode)
|
||||
let n = regs[rb].node
|
||||
regs[ra].node = newIntNode(nkIntLit, n.info.line)
|
||||
regs[ra].node.info = n.info
|
||||
regs[ra].node.typ = n.typ
|
||||
of opcNGetColumn:
|
||||
decodeB(rkNode)
|
||||
let n = regs[rb].node
|
||||
regs[ra].node = newIntNode(nkIntLit, n.info.col)
|
||||
regs[ra].node.info = n.info
|
||||
regs[ra].node.typ = n.typ
|
||||
of opcEqIdent:
|
||||
decodeBC(rkInt)
|
||||
if regs[rb].node.kind == nkIdent and regs[rc].node.kind == nkIdent:
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ type
|
|||
opcNError,
|
||||
opcNWarning,
|
||||
opcNHint,
|
||||
opcNLineInfo,
|
||||
opcNGetLine, opcNGetColumn, opcNGetFile,
|
||||
opcEqIdent,
|
||||
opcStrToIdent,
|
||||
opcIdentToStr,
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,16 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
|||
of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent)
|
||||
of mEqNimrodNode: genBinaryABC(c, n, dest, opcEqNimrodNode)
|
||||
of mSameNodeType: genBinaryABC(c, n, dest, opcSameNodeType)
|
||||
of mNLineInfo: genUnaryABC(c, n, dest, opcNLineInfo)
|
||||
of mNLineInfo:
|
||||
case n[0].sym.name.s
|
||||
of "getFile":
|
||||
genUnaryABC(c, n, dest, opcNGetFile)
|
||||
of "getLine":
|
||||
genUnaryABC(c, n, dest, opcNGetLine)
|
||||
of "getColumn":
|
||||
genUnaryABC(c, n, dest, opcNGetColumn)
|
||||
else:
|
||||
internalAssert false
|
||||
of mNHint:
|
||||
unused(n, dest)
|
||||
genUnaryStmt(c, n, opcNHint)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue