Fix dispatcher creation for method prototypes.
When method prototypes were involved (e.g. forward declarations for mutual recursion), calls were sometimes dispatched to the wrong method implementation. One of the reasons was that method dispatchers were then not always attached to method ASTs in the correct place.
This commit is contained in:
parent
bce2d57d95
commit
ce9a57fcfd
3 changed files with 92 additions and 28 deletions
|
|
@ -625,10 +625,9 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
|
|||
# use the dispatcher for the call:
|
||||
if s.sons[0].kind == nkSym and s.sons[0].sym.kind == skMethod:
|
||||
let t = lastSon(s.sons[0].sym.ast)
|
||||
if t.kind == nkSym and sfDispatcher in t.sym.flags:
|
||||
result = methodCall(s).PTransNode
|
||||
else:
|
||||
result = s.PTransNode
|
||||
if t.kind != nkSym or sfDispatcher notin t.sym.flags:
|
||||
methodDef(s.sons[0].sym, false)
|
||||
result = methodCall(s).PTransNode
|
||||
else:
|
||||
result = s.PTransNode
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue