mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
@@ -945,11 +945,12 @@ proc allPathsAsgnResult(n: PNode): InitResultEnum =
|
||||
# assignment this is not good enough! The only pattern we allow for
|
||||
# is 'finally: result = x'
|
||||
result = InitSkippable
|
||||
for it in n:
|
||||
if it.kind == nkFinally:
|
||||
result = allPathsAsgnResult(it.lastSon)
|
||||
allPathsInBranch(n[0])
|
||||
for i in 1..<n.len:
|
||||
if n[i].kind == nkFinally:
|
||||
result = allPathsAsgnResult(n[i].lastSon)
|
||||
else:
|
||||
allPathsInBranch(it.lastSon)
|
||||
allPathsInBranch(n[i].lastSon)
|
||||
else:
|
||||
for i in 0..<n.safeLen:
|
||||
allPathsInBranch(n[i])
|
||||
|
||||
@@ -7,6 +7,7 @@ axc
|
||||
0 new: 0
|
||||
...
|
||||
destroying GenericObj[T] GenericObj[system.int]
|
||||
test
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -117,3 +118,19 @@ proc main12() =
|
||||
echo "..."
|
||||
|
||||
main12()
|
||||
|
||||
#####################################################################
|
||||
## bug #12827
|
||||
type
|
||||
MyObject = object
|
||||
x: string
|
||||
y: seq[string]
|
||||
needs_ref: ref int
|
||||
|
||||
proc xx(xml: string): MyObject =
|
||||
let stream = xml
|
||||
result.x = xml
|
||||
defer: echo stream
|
||||
|
||||
|
||||
discard xx("test")
|
||||
|
||||
Reference in New Issue
Block a user