mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
remove unnecessary framePtr code (#19645)
(cherry picked from commit afbcba909b)
This commit is contained in:
@@ -773,7 +773,8 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) =
|
||||
var tmpFramePtr = rope"F"
|
||||
if optStackTrace notin p.options:
|
||||
tmpFramePtr = p.getTemp(true)
|
||||
line(p, tmpFramePtr & " = framePtr;\L")
|
||||
if hasFrameInfo(p):
|
||||
line(p, tmpFramePtr & " = framePtr;\L")
|
||||
lineF(p, "try {$n", [])
|
||||
var a: TCompRes
|
||||
gen(p, n[0], a)
|
||||
@@ -782,7 +783,8 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) =
|
||||
if catchBranchesExist:
|
||||
p.body.addf("--excHandler;$n} catch (EXCEPTION) {$n var prevJSError = lastJSError;$n" &
|
||||
" lastJSError = EXCEPTION;$n --excHandler;$n", [])
|
||||
line(p, "framePtr = $1;$n" % [tmpFramePtr])
|
||||
if hasFrameInfo(p):
|
||||
line(p, "framePtr = $1;$n" % [tmpFramePtr])
|
||||
while i < n.len and n[i].kind == nkExceptBranch:
|
||||
if n[i].len == 1:
|
||||
# general except section:
|
||||
@@ -841,7 +843,8 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) =
|
||||
line(p, "}\L")
|
||||
lineF(p, "lastJSError = prevJSError;$n")
|
||||
line(p, "} finally {\L")
|
||||
line(p, "framePtr = $1;$n" % [tmpFramePtr])
|
||||
if hasFrameInfo(p):
|
||||
line(p, "framePtr = $1;$n" % [tmpFramePtr])
|
||||
if i < n.len and n[i].kind == nkFinally:
|
||||
genStmt(p, n[i][0])
|
||||
line(p, "}\L")
|
||||
|
||||
@@ -130,7 +130,8 @@ proc unhandledException(e: ref Exception) {.
|
||||
when NimStackTrace:
|
||||
add(buf, rawWriteStackTrace())
|
||||
let cbuf = cstring(buf)
|
||||
framePtr = nil
|
||||
when NimStackTrace:
|
||||
framePtr = nil
|
||||
{.emit: """
|
||||
if (typeof(Error) !== "undefined") {
|
||||
throw new Error(`cbuf`);
|
||||
|
||||
Reference in New Issue
Block a user