mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-18 02:27:10 +00:00
@@ -658,15 +658,16 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) =
|
||||
line(p, "}\L")
|
||||
|
||||
proc genRaiseStmt(p: PProc, n: PNode) =
|
||||
genLineDir(p, n)
|
||||
if n.sons[0].kind != nkEmpty:
|
||||
var a: TCompRes
|
||||
gen(p, n.sons[0], a)
|
||||
let typ = skipTypes(n.sons[0].typ, abstractPtrs)
|
||||
genLineDir(p, n)
|
||||
useMagic(p, "raiseException")
|
||||
lineF(p, "raiseException($1, $2);$n",
|
||||
[a.rdLoc, makeJSString(typ.sym.name.s)])
|
||||
else:
|
||||
genLineDir(p, n)
|
||||
useMagic(p, "reraiseException")
|
||||
line(p, "reraiseException();\L")
|
||||
|
||||
@@ -856,6 +857,7 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||
else:
|
||||
gen(p, x, a)
|
||||
|
||||
genLineDir(p, y)
|
||||
gen(p, y, b)
|
||||
|
||||
# we don't care if it's an etyBaseIndex (global) of a string, it's
|
||||
@@ -892,11 +894,9 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||
lineF(p, "$1 = $2;$n", [a.res, b.res])
|
||||
|
||||
proc genAsgn(p: PProc, n: PNode) =
|
||||
genLineDir(p, n)
|
||||
genAsgnAux(p, n.sons[0], n.sons[1], noCopyNeeded=false)
|
||||
|
||||
proc genFastAsgn(p: PProc, n: PNode) =
|
||||
genLineDir(p, n)
|
||||
# 'shallowCopy' always produced 'noCopyNeeded = true' here but this is wrong
|
||||
# for code like
|
||||
# while j >= pos:
|
||||
|
||||
26
tests/js/t7224.nim
Normal file
26
tests/js/t7224.nim
Normal file
@@ -0,0 +1,26 @@
|
||||
discard """
|
||||
cmd: "nim $target $options --stackTrace:on --lineTrace:on $file"
|
||||
outputsub: '''
|
||||
t7224.aaa, line: 21
|
||||
t7224.bbb, line: 18
|
||||
t7224.ccc, line: 15
|
||||
t7224.ddd, line: 12
|
||||
'''
|
||||
"""
|
||||
|
||||
proc ddd() =
|
||||
raise newException(IOError, "didn't do stuff")
|
||||
|
||||
proc ccc() =
|
||||
ddd()
|
||||
|
||||
proc bbb() =
|
||||
ccc()
|
||||
|
||||
proc aaa() =
|
||||
bbb()
|
||||
|
||||
try:
|
||||
aaa()
|
||||
except IOError as e:
|
||||
echo getStackTrace(e)
|
||||
Reference in New Issue
Block a user