Browse Source

- all : *.Boot are now automatically kept without the need of marking them with @:keep

Franco Ponticelli 14 years ago
parent
commit
88f29e5320
7 changed files with 18 additions and 8 deletions
  1. 1 1
      std/flash/Boot.hx
  2. 2 2
      std/flash9/Boot.hx
  3. 1 1
      std/js/Boot.hx
  4. 1 1
      std/neko/Boot.hx
  5. 1 1
      std/php/Boot.hx
  6. 1 0
      std/php/_std/Xml.hx
  7. 11 2
      typeload.ml

+ 1 - 1
std/flash/Boot.hx

@@ -24,7 +24,7 @@
  */
  */
 package flash;
 package flash;
 
 
-@:keep class Boot {
+class Boot {
 
 
 	private static var def_color = 0;
 	private static var def_color = 0;
 	private static var exception = null;
 	private static var exception = null;

+ 2 - 2
std/flash9/Boot.hx

@@ -25,7 +25,7 @@
 package flash;
 package flash;
 
 
 #if !as3
 #if !as3
-@:keep private class RealBoot extends Boot, implements Dynamic {
+private class RealBoot extends Boot, implements Dynamic {
 	#if swc
 	#if swc
 	public function new() {
 	public function new() {
 		super();
 		super();
@@ -44,7 +44,7 @@ package flash;
 }
 }
 #end
 #end
 
 
-@:keep class Boot extends flash.display.MovieClip {
+class Boot extends flash.display.MovieClip {
 
 
 	static var tf : flash.text.TextField;
 	static var tf : flash.text.TextField;
 	static var lines : Array<String>;
 	static var lines : Array<String>;

+ 1 - 1
std/js/Boot.hx

@@ -24,7 +24,7 @@
  */
  */
 package js;
 package js;
 
 
-@:keep class Boot {
+class Boot {
 
 
 	private static function __unhtml(s : String) {
 	private static function __unhtml(s : String) {
 		return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
 		return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");

+ 1 - 1
std/neko/Boot.hx

@@ -24,7 +24,7 @@
  */
  */
 package neko;
 package neko;
 
 
-@:keep class Boot {
+class Boot {
 
 
 	private static function __tmp_str() {
 	private static function __tmp_str() {
 		return untyped "<...>".__s;
 		return untyped "<...>".__s;

+ 1 - 1
std/php/Boot.hx

@@ -1,6 +1,6 @@
 package php;
 package php;
 
 
-@:keep class Boot {
+class Boot {
 	static var qtypes;
 	static var qtypes;
 	static var ttypes;
 	static var ttypes;
 	static var tpaths;
 	static var tpaths;

+ 1 - 0
std/php/_std/Xml.hx

@@ -1,3 +1,4 @@
+import php.Lib;
 /*
 /*
  * Copyright (c) 2005, The haXe Project Contributors
  * Copyright (c) 2005, The haXe Project Contributors
  * All rights reserved.
  * All rights reserved.

+ 11 - 2
typeload.ml

@@ -801,7 +801,16 @@ let init_class ctx c p herits fields =
 			) in
 			) in
 			let delay = if (ctx.com.dead_code_elimination && not !Common.display) then begin
 			let delay = if (ctx.com.dead_code_elimination && not !Common.display) then begin
 				let is_main = (match ctx.com.main_class with | Some cl when c.cl_path = cl -> true | _ -> false) && name = "main" in
 				let is_main = (match ctx.com.main_class with | Some cl when c.cl_path = cl -> true | _ -> false) && name = "main" in
-				let keep = core_api || is_main || has_meta ":keep" c.cl_meta || has_meta ":keep" f.cff_meta || (stat && name = "__init__") in
+				let platform_boot pf = match pf with
+					| Flash -> [["flash"], "Boot"]
+					| Flash9 -> [["flash"; "_Boot"], "RealBoot"; ["flash"], "Boot"]
+					| Js -> [["js"], "Boot"]
+					| Neko -> [["neko"], "Boot"]
+					| Php -> [["php"], "Boot"]
+					| Cpp -> [["cpp"], "Boot"]
+					| _ -> [] in
+				let must_keep = (List.exists (fun p -> p = c.cl_path) (platform_boot ctx.com.platform)) in
+				let keep = core_api || is_main || must_keep || has_meta ":keep" c.cl_meta || has_meta ":keep" f.cff_meta || (stat && name = "__init__") in
 				let remove item lst = List.filter (fun i -> item <> i.cf_name) lst in
 				let remove item lst = List.filter (fun i -> item <> i.cf_name) lst in
 				if ((c.cl_extern && not inline) || c.cl_interface) && cf.cf_name <> "__init__" then begin
 				if ((c.cl_extern && not inline) || c.cl_interface) && cf.cf_name <> "__init__" then begin
 					(fun() -> ())
 					(fun() -> ())
@@ -813,7 +822,7 @@ let init_class ctx c p herits fields =
 								
 								
 								match cf.cf_expr with
 								match cf.cf_expr with
 								| None ->
 								| None ->
-									if ctx.com.verbose then print_endline ("Removed " ^ (snd c.cl_path) ^ "." ^ name);
+									if ctx.com.verbose then print_endline ("Removed " ^ (s_type_path c.cl_path) ^ "." ^ name);
 									if stat then begin
 									if stat then begin
 										c.cl_statics <- PMap.remove name c.cl_statics;
 										c.cl_statics <- PMap.remove name c.cl_statics;
 										c.cl_ordered_statics <- remove name c.cl_ordered_statics;
 										c.cl_ordered_statics <- remove name c.cl_ordered_statics;