diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-01-05 22:18:18 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-01-05 22:18:18 +0100 |
commit | f22f13c56832da810e297039f858f8b129661a4b (patch) | |
tree | fafe07a96a26a2908f18ca0ab9b58feb71832442 /src/typing.ml | |
parent | fa1ac115930822efb86f2c02f87f48bc9bdc3ad0 (diff) | |
download | LPC-Projet-f22f13c56832da810e297039f858f8b129661a4b.tar.gz LPC-Projet-f22f13c56832da810e297039f858f8b129661a4b.zip |
Handle EQIdent properl
Diffstat (limited to 'src/typing.ml')
-rw-r--r-- | src/typing.ml | 8 |
1 files 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 |