- var callsite = v.get_method(self, recvtype, name, self.n_expr isa ASelfExpr)
- if callsite == null then return
+ var callsite = null
+ var unsafe_type = v.anchor_to(recvtype)
+ var mproperty = v.try_get_mproperty_by_name2(node, unsafe_type, name)
+ if mproperty == null and nrecv isa AImplicitSelfExpr then
+ # Special fall-back search in `sys` when noting found in the implicit receiver.
+ var sysclass = v.try_get_mclass(node, "Sys")
+ if sysclass != null then
+ var systype = sysclass.mclass_type
+ mproperty = v.try_get_mproperty_by_name2(node, systype, name)
+ if mproperty != null then
+ callsite = v.get_method(node, systype, name, false)
+ if callsite == null then return # Forward error
+ # Update information, we are looking at `sys` now, not `self`
+ nrecv.is_sys = true
+ nrecv.its_variable = null
+ nrecv.mtype = systype
+ recvtype = systype
+ end
+ end
+ end
+ if callsite == null then
+ # If still nothing, just exit
+ callsite = v.get_method(node, recvtype, name, nrecv isa ASelfExpr)
+ if callsite == null then return
+ end
+