From f22f13c56832da810e297039f858f8b129661a4b Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sun, 5 Jan 2014 22:18:18 +0100 Subject: Handle EQIdent properl --- src/typing.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/typing.ml b/src/typing.ml index dae139c..3fd0f72 100644 --- a/src/typing.ml +++ b/src/typing.ml @@ -418,8 +418,12 @@ and compute_type env e = | Some k -> let sc = try find_cls_superclass env.b_pe k.tc_name c with Not_found -> ty_error (c ^ " is no superclass of current class " ^ k.tc_name) in - Some e_this_not_ptr, - closest_proto env.b_pe args_types (find_protos_in_class env.b_pe sc.h_class i) + let proto = closest_proto env.b_pe args_types (find_protos_in_class env.b_pe sc.h_class i) in + let upcasted = if proto.tp_virtual = None + then upcast env.b_pe e_this_not_ptr (TClass(c)) + else upcast env.b_pe e_this_not_ptr + (TClass (match proto.tp_class with | None -> assert false | Some k -> k)) in + Some upcasted, proto | None -> ty_error "Qualified identifier in a function belonging to no class." end | _ -> ty_error "Calling something that is neither a function nor a method") in -- cgit v1.2.3