+redef class AAbsSendExpr
+ # Compute the called global property
+ private fun do_typing(v: TypingVisitor, type_recv: MMType, is_implicit_self: Bool, recv_is_self: Bool, name: Symbol, raw_args: nullable Array[AExpr], closure_defs: nullable Array[AClosureDef])
+ do
+ var prop = get_property(v, type_recv, is_implicit_self, name)
+ if prop == null then return
+ var sig = get_signature(v, type_recv, prop, recv_is_self)
+ if not process_signature(v, sig, prop.name, raw_args) then return
+ var rtype = process_closures(v, sig, prop.name, closure_defs)
+ if rtype == null and sig.return_type != null then return
+ _prop = prop
+ _prop_signature = sig
+ _return_type = rtype
+ end
+
+ private fun get_property(v: TypingVisitor, type_recv: MMType, is_implicit_self: Bool, name: Symbol): nullable MMMethod
+ do
+ if type_recv isa MMTypeNone then
+ if name == (once "==".to_symbol) or name == (once "!=".to_symbol) then
+ # Special case on != and == that are allowed for 'null'
+ type_recv = v.type_object.as_nullable
+ else
+ v.error(self, "Error: Method '{name}' call on 'null'.")
+ return null
+ end
+ end
+ var lc = type_recv.local_class
+ var prop: nullable MMMethod = null
+ if lc.has_global_property_by_name(name) then prop = lc.select_method(name)
+ if prop == null and v.local_property.global.is_init then
+ var props = lc.super_methods_named(name)
+ if props.length > 1 then
+ v.error(self, "Error: Ambigous method name '{name}' for {props.join(", ")}. Use explicit designation.")
+ return null
+ else if props.length == 1 then
+ var p = lc[props.first.global]
+ assert p isa MMMethod
+ prop = p
+ end
+
+ end
+ if prop == null then
+ if is_implicit_self then
+ v.error(self, "Error: Method or variable '{name}' unknown in {type_recv}.")
+ else
+ v.error(self, "Error: Method '{name}' doesn't exists in {type_recv}.")
+ end
+ return null
+ end
+ return prop
+ end