diff options
Diffstat (limited to 'src/typing.ml')
-rw-r--r-- | src/typing.ml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/typing.ml b/src/typing.ml index bc53dff..56942f1 100644 --- a/src/typing.ml +++ b/src/typing.ml @@ -93,7 +93,7 @@ and tproto = { and tcls_supers = tcls_hier list and tcls_hier = { h_class : tident; - h_pos : int; + mutable h_pos : int; mutable h_vtable : (int * tproto) list; (* only to be muted during class definition parsing *) h_supers : tcls_supers } @@ -735,6 +735,18 @@ let compute_tclass env c = tp_ret_type = None; tp_args = [] }::meth in + (* if vtable is empty, remove it *) + let mem, mem_u = + if hier.h_vtable = [] then + let rec mv_h h = + h.h_pos <- h.h_pos - 4; + List.iter mv_h h.h_supers + in + List.iter mv_h hier.h_supers; + Smap.map (fun (ty, pos) -> (ty, pos-4)) mem, mem_u - 4 + else + mem, mem_u + in { tc_name = cls_name; tc_size = mem_u; tc_hier = hier; |