parent
6d10b365fe
commit
91935fd915
5 changed files with 47 additions and 1 deletions
|
|
@ -194,6 +194,8 @@ proc genLineDir(p: BProc, t: PNode) =
|
||||||
var tt = t
|
var tt = t
|
||||||
#while tt.kind in {nkStmtListExpr}+nkCallKinds:
|
#while tt.kind in {nkStmtListExpr}+nkCallKinds:
|
||||||
# tt = tt.lastSon
|
# tt = tt.lastSon
|
||||||
|
if tt.kind in nkCallKinds and tt.len > 1:
|
||||||
|
tt = tt.sons[1]
|
||||||
let line = tt.info.safeLineNm
|
let line = tt.info.safeLineNm
|
||||||
|
|
||||||
if optEmbedOrigSrc in gGlobalOptions:
|
if optEmbedOrigSrc in gGlobalOptions:
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,25 @@ proc evalTemplateArgs(n: PNode, s: PSym; fromHlo: bool): PNode =
|
||||||
var evalTemplateCounter* = 0
|
var evalTemplateCounter* = 0
|
||||||
# to prevent endless recursion in templates instantiation
|
# to prevent endless recursion in templates instantiation
|
||||||
|
|
||||||
|
proc wrapInComesFrom*(info: TLineInfo; res: PNode): PNode =
|
||||||
|
when true:
|
||||||
|
result = res
|
||||||
|
result.info = info
|
||||||
|
if result.kind in {nkStmtList, nkStmtListExpr}:
|
||||||
|
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.sons[i].info = info
|
||||||
|
else:
|
||||||
|
result = newNodeI(nkPar, info)
|
||||||
|
result.add res
|
||||||
|
result.flags.incl nfNone
|
||||||
|
|
||||||
proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym; fromHlo=false): PNode =
|
proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym; fromHlo=false): PNode =
|
||||||
inc(evalTemplateCounter)
|
inc(evalTemplateCounter)
|
||||||
if evalTemplateCounter > 100:
|
if evalTemplateCounter > 100:
|
||||||
|
|
@ -132,5 +151,5 @@ proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym; fromHlo=false): PNode =
|
||||||
#if ctx.instLines: result.info = n.info
|
#if ctx.instLines: result.info = n.info
|
||||||
for i in countup(0, safeLen(body) - 1):
|
for i in countup(0, safeLen(body) - 1):
|
||||||
evalTemplateAux(body.sons[i], args, ctx, result)
|
evalTemplateAux(body.sons[i], args, ctx, result)
|
||||||
|
result = wrapInComesFrom(n.info, result)
|
||||||
dec(evalTemplateCounter)
|
dec(evalTemplateCounter)
|
||||||
|
|
|
||||||
|
|
@ -369,6 +369,7 @@ proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
|
||||||
result = evalMacroCall(c.module, c.cache, n, nOrig, sym)
|
result = evalMacroCall(c.module, c.cache, n, nOrig, sym)
|
||||||
if efNoSemCheck notin flags:
|
if efNoSemCheck notin flags:
|
||||||
result = semAfterMacroCall(c, result, sym, flags)
|
result = semAfterMacroCall(c, result, sym, flags)
|
||||||
|
result = wrapInComesFrom(nOrig.info, result)
|
||||||
popInfoContext()
|
popInfoContext()
|
||||||
|
|
||||||
proc forceBool(c: PContext, n: PNode): PNode =
|
proc forceBool(c: PContext, n: PNode): PNode =
|
||||||
|
|
|
||||||
13
tests/errmsgs/tdont_show_system.nim
Normal file
13
tests/errmsgs/tdont_show_system.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "value of type 'bool' has to be discarded"
|
||||||
|
line: 13
|
||||||
|
file: "tdont_show_system.nim"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #4308
|
||||||
|
|
||||||
|
#proc getGameTile: int =
|
||||||
|
# 1 > 0
|
||||||
|
|
||||||
|
# bug #4905 subsumes the problem of #4308:
|
||||||
|
true notin {false}
|
||||||
11
tests/errmsgs/tproper_stacktrace.nim
Normal file
11
tests/errmsgs/tproper_stacktrace.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
discard """
|
||||||
|
outputsub: '''tproper_stacktrace.nim(7) tproper_stacktrace'''
|
||||||
|
exitcode: 1
|
||||||
|
"""
|
||||||
|
|
||||||
|
template fuzzy(x) =
|
||||||
|
echo x[] != 9
|
||||||
|
|
||||||
|
var p: ptr int
|
||||||
|
fuzzy p
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue