summary refs log tree commit diff stats
path: root/compiler/cgen.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-12-19 11:35:45 +0100
committerAraq <rumpf_a@web.de>2016-12-19 11:35:45 +0100
commit237252f90cbea354ee7104388b174f0ed899803c (patch)
tree498e985bb160e21c79f5c7c84975e2e6b1cc819b /compiler/cgen.nim
parent24239c23619e9d64562699b5d890fa2575e9c9cb (diff)
parentc130a2af17e0d5e948d21e6cb5bd0aca02ddb977 (diff)
downloadNim-237252f90cbea354ee7104388b174f0ed899803c.tar.gz
Merge branch 'devel' into sighashes
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r--compiler/cgen.nim25
1 files changed, 14 insertions, 11 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 082512753..0ca8e46fc 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -184,24 +184,27 @@ proc freshLineInfo(p: BProc; info: TLineInfo): bool =
     result = true
 
 proc genLineDir(p: BProc, t: PNode) =
-  let info = t.info
-  #if t.kind in nkCallKinds+{nkStmtListExpr} and t.len > 1: t[1].info
-  #else: t.info
-  var line = info.safeLineNm
+  var tt = t
+  #while tt.kind in {nkStmtListExpr}+nkCallKinds:
+  #  tt = tt.lastSon
+  if tt.kind in nkCallKinds and tt.len > 1:
+    tt = tt.sons[1]
+  let line = tt.info.safeLineNm
+
   if optEmbedOrigSrc in gGlobalOptions:
-    add(p.s(cpsStmts), ~"//" & info.sourceLine & rnl)
-  genCLineDir(p.s(cpsStmts), info.toFullPath, line)
+    add(p.s(cpsStmts), ~"//" & tt.info.sourceLine & rnl)
+  genCLineDir(p.s(cpsStmts), tt.info.toFullPath, line)
   if ({optStackTrace, optEndb} * p.options == {optStackTrace, optEndb}) and
       (p.prc == nil or sfPure notin p.prc.flags):
-    if freshLineInfo(p, info):
+    if freshLineInfo(p, tt.info):
       linefmt(p, cpsStmts, "#endb($1, $2);$n",
-              line.rope, makeCString(toFilename(info)))
+              line.rope, makeCString(toFilename(tt.info)))
   elif ({optLineTrace, optStackTrace} * p.options ==
       {optLineTrace, optStackTrace}) and
-      (p.prc == nil or sfPure notin p.prc.flags) and info.fileIndex >= 0:
-    if freshLineInfo(p, info):
+      (p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex >= 0:
+    if freshLineInfo(p, tt.info):
       linefmt(p, cpsStmts, "nimln($1, $2);$n",
-              line.rope, info.quotedFilename)
+              line.rope, tt.info.quotedFilename)
 
 proc postStmtActions(p: BProc) {.inline.} =
   add(p.s(cpsStmts), p.module.injectStmt)