mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 14:03:23 +00:00
@@ -264,7 +264,8 @@ proc genBreakOrRaiseAux(c: var Con, i: int, n: PNode) =
|
||||
c.blocks[i].raiseFixups.add lab1
|
||||
else:
|
||||
var trailingFinales: seq[PNode]
|
||||
if c.inTryStmt > 0: #Ok, we are in a try, lets see which (if any) try's we break out from:
|
||||
if c.inTryStmt > 0:
|
||||
# Ok, we are in a try, lets see which (if any) try's we break out from:
|
||||
for b in countdown(c.blocks.high, i):
|
||||
if c.blocks[b].isTryBlock:
|
||||
trailingFinales.add c.blocks[b].finale
|
||||
@@ -385,7 +386,8 @@ proc genCall(c: var Con; n: PNode) =
|
||||
# Pass by 'out' is a 'must def'. Good enough for a move optimizer.
|
||||
genDef(c, n[i])
|
||||
# every call can potentially raise:
|
||||
if false: # c.inTryStmt > 0 and canRaiseConservative(n[0]):
|
||||
if c.inTryStmt > 0 and canRaiseConservative(n[0]):
|
||||
inc c.interestingInstructions
|
||||
# we generate the instruction sequence:
|
||||
# fork lab1
|
||||
# goto exceptionHandler (except or finally)
|
||||
|
||||
22
tests/arc/tmove_regression.nim
Normal file
22
tests/arc/tmove_regression.nim
Normal file
@@ -0,0 +1,22 @@
|
||||
discard """
|
||||
output: '''/1/2
|
||||
/1
|
||||
/
|
||||
'''
|
||||
""""
|
||||
|
||||
# bug #22001
|
||||
|
||||
import std / [os, strutils]
|
||||
|
||||
proc finOp2(path, name: string): (string, File) = # Find & open FIRST `name`
|
||||
var current = path
|
||||
while true:
|
||||
if current.isRootDir: break # <- current=="" => current.isRootDir
|
||||
current = current.parentDir
|
||||
let dir = current
|
||||
echo dir.replace('\\', '/') # Commenting out try/except below hides bug
|
||||
try: result[0] = dir/name; result[1] = open(result[0]); return
|
||||
except CatchableError: discard
|
||||
|
||||
discard finOp2("/1/2/3", "4") # All same if this->inside a proc
|
||||
Reference in New Issue
Block a user