|
@@ -352,6 +352,10 @@ let fake_tnull =
|
|
|
a_params = ["T",t_dynamic];
|
|
|
}
|
|
|
|
|
|
+let alloc_vid =
|
|
|
+ let vid = ref 0 in
|
|
|
+ (fun() -> incr vid; !vid)
|
|
|
+
|
|
|
let rec to_type ?tref ctx t =
|
|
|
match t with
|
|
|
| TMono r ->
|
|
@@ -395,6 +399,7 @@ let rec to_type ?tref ctx t =
|
|
|
PMap.find a ctx.anons_cache
|
|
|
with Not_found ->
|
|
|
let vp = {
|
|
|
+ vid = alloc_vid();
|
|
|
vfields = [||];
|
|
|
vindex = PMap.empty;
|
|
|
} in
|
|
@@ -541,6 +546,7 @@ and class_type ?(tref=None) ctx c pl statics =
|
|
|
PMap.find key_path ctx.cached_types
|
|
|
with Not_found when c.cl_interface && not statics ->
|
|
|
let vp = {
|
|
|
+ vid = alloc_vid();
|
|
|
vfields = [||];
|
|
|
vindex = PMap.empty;
|
|
|
} in
|
|
@@ -2797,8 +2803,16 @@ and eval_expr ctx e =
|
|
|
);
|
|
|
r
|
|
|
| TEnumParameter (ec,f,index) ->
|
|
|
- let r = alloc_tmp ctx (match to_type ctx ec.etype with HEnum e -> let _,_,args = e.efields.(f.ef_index) in args.(index) | _ -> assert false) in
|
|
|
- op ctx (OEnumField (r,eval_expr ctx ec,f.ef_index,index));
|
|
|
+ let pt, is_single = (match to_type ctx ec.etype with
|
|
|
+ | HEnum e ->
|
|
|
+ let _,_,args = e.efields.(f.ef_index) in
|
|
|
+ args.(index), Array.length e.efields = 1
|
|
|
+ | _ -> assert false
|
|
|
+ ) in
|
|
|
+ let er = eval_expr ctx ec in
|
|
|
+ if is_single then op ctx (ONullCheck er); (* #7560 *)
|
|
|
+ let r = alloc_tmp ctx pt in
|
|
|
+ op ctx (OEnumField (r,er,f.ef_index,index));
|
|
|
cast_to ctx r (to_type ctx e.etype) e.epos
|
|
|
| TContinue ->
|
|
|
before_break_continue ctx;
|