Open
Description
@Araq
while working on something else I noticed that nkComesFrom
is deadcode (never set) even though it's used quite a bit, so removing it would declutter a bit.
- is there any chance
nkComesFrom
might be revived or is the new code path inwrapInComesFrom
strictly better so thatnkComesFrom
can be removed + its corresponding code cleaned up? - was the goal of
nkComesFrom
to produce stacktrace entries for templates/macros as if they were function calls? if so, it would be useful to have it as an option (i had a WIP on that but done differently) but not sure that's what it was about
proc wrapInComesFrom*(info: TLineInfo; sym: PSym; res: PNode): PNode =
when true:
result = res
result.info = info
if result.kind in {nkStmtList, nkStmtListExpr} and result.len > 0:
result.lastSon.info = info
when false:
# this hack is required to
var x = result
while x.kind == nkStmtListExpr: x = x.lastSon
if x.kind in nkCallKinds:
for i in 1..<x.len:
if x[i].kind in nkCallKinds:
x[i].info = info
else:
result = newNodeI(nkStmtListExpr, info)
var d = newNodeI(nkComesFrom, info)
d.add newSymNode(sym, info)
result.add d
result.add res
result.typ = res.typ
eg, this code is also dead because of that:
if it.kind == nkComesFrom:
if hasNimFrame and frameName == nil:
inc p.labels
frameName = "FR" & rope(p.labels) & "_"
let theMacro = it[0].sym
add p.s(cpsStmts), initFrameNoDebug(p, frameName,
makeCString theMacro.name.s,
quotedFilename(p.config, theMacro.info), it.info.line.int)
as well as initFrameNoDebug
+ deinitFrameNoDebug
+ some other code
Metadata
Metadata
Assignees
Labels
No labels