diff options
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r-- | compiler/cgen.nim | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 89658279d..526a7b590 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -190,21 +190,24 @@ proc freshLineInfo(p: BProc; info: TLineInfo): bool = result = true proc genLineDir(p: BProc, t: PNode) = - var line = t.info.safeLineNm + let info = t.info + #if t.kind in nkCallKinds+{nkStmtListExpr} and t.len > 1: t[1].info + #else: t.info + var line = info.safeLineNm if optEmbedOrigSrc in gGlobalOptions: - add(p.s(cpsStmts), ~"//" & t.info.sourceLine & rnl) - genCLineDir(p.s(cpsStmts), t.info.toFullPath, line) + add(p.s(cpsStmts), ~"//" & info.sourceLine & rnl) + genCLineDir(p.s(cpsStmts), info.toFullPath, line) if ({optStackTrace, optEndb} * p.options == {optStackTrace, optEndb}) and (p.prc == nil or sfPure notin p.prc.flags): - if freshLineInfo(p, t.info): + if freshLineInfo(p, info): linefmt(p, cpsStmts, "#endb($1, $2);$n", - line.rope, makeCString(toFilename(t.info))) + line.rope, makeCString(toFilename(info))) elif ({optLineTrace, optStackTrace} * p.options == {optLineTrace, optStackTrace}) and - (p.prc == nil or sfPure notin p.prc.flags) and t.info.fileIndex >= 0: - if freshLineInfo(p, t.info): + (p.prc == nil or sfPure notin p.prc.flags) and info.fileIndex >= 0: + if freshLineInfo(p, info): linefmt(p, cpsStmts, "nimln($1, $2);$n", - line.rope, t.info.quotedFilename) + line.rope, info.quotedFilename) proc postStmtActions(p: BProc) {.inline.} = add(p.s(cpsStmts), p.module.injectStmt) |