@@ -140,7 +140,13 @@ proc eql(x, y: PNode; c: var EqlContext): bool =
140140 result = true
141141 elif x == nil or y == nil :
142142 result = false
143- elif x.kind == y.kind and x.safeLen == y.safeLen and x.flags == y.flags:
143+ elif x.kind != y.kind:
144+ echo " node kind mismatch: " , x.kind, " /" , y.kind
145+ result = false
146+ elif x.flags != y.flags:
147+ echo " node flag mismatch: " , x.flags, " /" , y.flags
148+ result = false
149+ elif x.safeLen == y.safeLen:
144150 if c.nodeStack.len != 0 :
145151 for i in countDown (c.nodeStack.len - 1 , 0 ):
146152 if x == c.nodeStack[i]:
@@ -160,16 +166,23 @@ proc eql(x, y: PNode; c: var EqlContext): bool =
160166 result = sameValue (x, y)
161167 of nkIdentDefs:
162168 assert x.len == 3 and y.len == 3
163- if eql (x[0 ], y[0 ], c) and eql (x[2 ], y[2 ], c):
164- result = y[ 1 ].kind == nkEmpty and y[ 0 ].sym.typ != nil
169+ if eql (x[0 ], y[0 ], c) and eql (x[2 ], y[2 ], c) and y[ 1 ].kind == nkEmpty and y[ 0 ].sym.typ != nil :
170+ result = true
165171 else :
172+ echo " nkIdentDefs mismatch"
166173 result = false
167174 of nkTypeDef:
168175 assert x.len == 3 and y.len == 3
169176 if eql (x[0 ], y[0 ], c) and eql (x[1 ], y[1 ], c):
170- result = y[2 ].kind == nkEmpty and y[0 ].sym.typ != nil
177+ let sym = if y[0 ].kind == nkPostfix:
178+ y[0 ][1 ].sym
179+ else :
180+ y[0 ].sym
181+ result = y[2 ].kind == nkEmpty and sym.typ != nil
171182 else :
172183 result = false
184+ if not result :
185+ echo " nkTypeDef mismatch"
173186 else :
174187 result = true
175188 for i in 0 ..< x.safeLen:
@@ -178,6 +191,9 @@ proc eql(x, y: PNode; c: var EqlContext): bool =
178191 break
179192 discard c.nodeStack.pop
180193 else :
194+ echo " node length mismatch"
195+ debug (x)
196+ debug (y)
181197 result = false
182198
183199proc testNifEncDec (graph: ModuleGraph ; src: string ) =
0 commit comments