Browse Source

fixed DCE + properties (fixed issue #680)

Nicolas Cannasse 13 years ago
parent
commit
4fc630a59c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      typeload.ml

+ 8 - 0
typeload.ml

@@ -1044,6 +1044,14 @@ let init_class ctx c p herits fields =
 				cf_public = is_public f.cff_access None;
 				cf_public = is_public f.cff_access None;
 				cf_params = [];
 				cf_params = [];
 			} in
 			} in
+			if ctx.com.dead_code_elimination && not ctx.com.display then begin
+				let r = exc_protect (fun r ->
+					r := (fun() -> ret);
+					mark_used cf;
+					ret
+				) in
+				cf.cf_type <- TLazy r;
+			end;
 			f, false, cf, (fun() -> (!check_get)(); (!check_set)())
 			f, false, cf, (fun() -> (!check_get)(); (!check_set)())
 	in
 	in
 	let rec check_require = function
 	let rec check_require = function