(cherry picked from commit 6be9b98e35)
This commit is contained in:
Clyybber
2019-05-09 22:58:41 +02:00
committed by narimiran
parent 8c4c3464e1
commit b85cc17998
2 changed files with 24 additions and 4 deletions

View File

@@ -181,9 +181,16 @@ proc isPartOf*(a, b: PNode): TAnalysisResult =
else: discard
of nkObjConstr:
result = arNo
for i in 1..<b.len:
for i in 1 ..< b.len:
let res = isPartOf(a, b[i][1])
if res != arNo:
result = res
if res == arYes: break
of nkCall:
result = arNo
for i in 1 ..< b.len:
let res = isPartOf(a, b[i])
if res != arNo:
result = res
if res == arYes: break
else: discard

View File

@@ -1,5 +1,6 @@
discard """
output: '''(10, (20, ))'''
output: '''(10, (20, ))
42'''
"""
import strutils, sequtils
@@ -22,5 +23,17 @@ proc dosomething(): seq[TThing] =
result = @[TThing(data: 10, children: result)]
when isMainModule:
echo($dosomething()[0])
echo($dosomething()[0])
# bug #9844
proc f(v: int): int = v
type X = object
v: int
var x = X(v: 42)
x = X(v: f(x.v))
echo x.v