@@ -327,6 +327,8 @@ let rec type_inline ctx cf f ethis params tret p force =
This could be fixed with better post process code cleanup (planed)
*)
if !cancel_inlining || (Common.platform ctx.com Js && not force && (init <> None || !has_vars)) then begin
+ (* we have to make sure that we mark the field as used here so DCE does not remove it *)
+ mark_used_field ctx cf;
None
end else
let wrap e =
@@ -251,3 +251,6 @@ let feature_name = function
let activate_feature ctx ft = Hashtbl.replace ctx.g.features (feature_name ft) ft
let has_feature ctx s = Hashtbl.mem ctx.g.features s
+
+let mark_used_field ctx f =
+ if ctx.com.dead_code_elimination && not (has_meta ":?used" f.cf_meta) then f.cf_meta <- (":?used",[],f.cf_pos) :: f.cf_meta
@@ -77,9 +77,6 @@ let rec mark_used_class ctx c =
let mark_used_enum ctx e =
if ctx.com.dead_code_elimination && not (has_meta ":?used" e.e_meta) then e.e_meta <- (":?used",[],e.e_pos) :: e.e_meta
-let mark_used_field ctx f =
- if ctx.com.dead_code_elimination && not (has_meta ":?used" f.cf_meta) then f.cf_meta <- (":?used",[],f.cf_pos) :: f.cf_meta
-
type type_class =
| KInt
| KFloat