Sfoglia il codice sorgente

Cancel object inlining if it's fields are used before being initialized. (#10304)

Mario Carbajal 4 anni fa
parent
commit
11eb923e98
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      src/optimization/inlineConstructors.ml

+ 2 - 1
src/optimization/inlineConstructors.ml

@@ -316,7 +316,8 @@ let inline_constructors ctx original_e =
 						let iv_is_const iv = match iv.iv_kind with IVKField(_,_,Some(_)) -> true | _ -> false in
 						if is_lvalue && iv_is_const fiv then raise Not_found;
 						if fiv.iv_closed then raise Not_found;
-						if not captured || (not is_lvalue && fiv.iv_state == IVSUnassigned) then cancel_iv fiv efield.epos;
+						if not is_lvalue && fiv.iv_state == IVSUnassigned then raise Not_found;
+						if not captured then cancel_iv fiv efield.epos;
 						IOFInlineVar(fiv)
 					with Not_found ->
 						cancel_iv iv efield.epos;