Sfoglia il codice sorgente

move UV.init to asys.uv.Uv.__init__

Simon Krajewski 5 anni fa
parent
commit
99a6663306
4 ha cambiato i file con 10 aggiunte e 15 eliminazioni
  1. 1 1
      src/macro/eval/evalStdLib.ml
  2. 1 2
      src/typing/finalization.ml
  3. 5 1
      std/asys/uv/Uv.hx
  4. 3 11
      std/haxe/EntryPoint.hx

+ 1 - 1
src/macro/eval/evalStdLib.ml

@@ -4554,7 +4554,7 @@ let init_standard_library builtins =
 	init_fields builtins (["asys"],"FileOpenFlagsImpl") (uv_statics (Uv.get_file_open_flags())) [];
 	init_fields builtins (["asys"],"FileOpenFlagsImpl") (uv_statics (Uv.get_file_open_flags())) [];
 	init_fields builtins (["asys";"uv";"_UVErrorType"],"UVErrorType_Impl_") (uv_statics (Uv.get_errno())) [];
 	init_fields builtins (["asys";"uv";"_UVErrorType"],"UVErrorType_Impl_") (uv_statics (Uv.get_errno())) [];
 	init_fields builtins (["eval";"uv"],"File") [] [];
 	init_fields builtins (["eval";"uv"],"File") [] [];
-	init_fields builtins (["eval"],"Uv") [
+	init_fields builtins (["asys";"uv"],"Uv") [
 		"init",StdUv.init;
 		"init",StdUv.init;
 		"run",StdUv.run;
 		"run",StdUv.run;
 		"stop",StdUv.stop;
 		"stop",StdUv.stop;

+ 1 - 2
src/typing/finalization.ml

@@ -39,10 +39,9 @@ let get_main ctx types =
 				let ef = PMap.find name ec.cl_statics in
 				let ef = PMap.find name ec.cl_statics in
 				mk (TCall (mk (TField (et,FStatic (ec,ef))) ef.cf_type p,[])) ctx.t.tvoid p
 				mk (TCall (mk (TField (et,FStatic (ec,ef))) ef.cf_type p,[])) ctx.t.tvoid p
 			in
 			in
-			let init = mk_call "init" in
 			let run = mk_call "run" in
 			let run = mk_call "run" in
 			let close = mk_call "close" in
 			let close = mk_call "close" in
-			mk (TBlock [init;main;run;close]) ctx.t.tvoid p
+			mk (TBlock [main;run;close]) ctx.t.tvoid p
 		with Not_found ->
 		with Not_found ->
 			main
 			main
 		) in
 		) in

+ 5 - 1
std/eval/Uv.hx → std/asys/uv/Uv.hx

@@ -1,8 +1,12 @@
-package eval;
+package asys.uv;
 
 
 extern class Uv {
 extern class Uv {
 	static function init():Void;
 	static function init():Void;
 	static function run(mode:asys.uv.UVRunMode):Bool;
 	static function run(mode:asys.uv.UVRunMode):Bool;
 	static function stop():Void;
 	static function stop():Void;
 	static function close():Void;
 	static function close():Void;
+
+	static function __init__():Void {
+		Uv.init();
+	}
 }
 }

+ 3 - 11
std/haxe/EntryPoint.hx

@@ -102,12 +102,6 @@ class EntryPoint {
 		return time;
 		return time;
 	}
 	}
 
 
-	@:keep public static function init() {
-		#if eval
-		eval.Uv.init();
-		#end
-	}
-
 	/**
 	/**
 		Start the main loop. Depending on the platform, this can return immediately or will only return when the application exits.
 		Start the main loop. Depending on the platform, this can return immediately or will only return when the application exits.
 	**/
 	**/
@@ -137,9 +131,7 @@ class EntryPoint {
 		#elseif flash
 		#elseif flash
 		flash.Lib.current.stage.addEventListener(flash.events.Event.ENTER_FRAME, function(_) processEvents());
 		flash.Lib.current.stage.addEventListener(flash.events.Event.ENTER_FRAME, function(_) processEvents());
 		#elseif target.asys
 		#elseif target.asys
-		#if eval
-		eval.Uv.run(RunDefault);
-		#end
+		asys.uv.Uv.run(RunDefault);
 		#elseif sys
 		#elseif sys
 		while (true) {
 		while (true) {
 			var nextTick = processEvents();
 			var nextTick = processEvents();
@@ -154,8 +146,8 @@ class EntryPoint {
 	}
 	}
 
 
 	@:keep static public function close() {
 	@:keep static public function close() {
-		#if eval
-		eval.Uv.close();
+		#if target.asys
+		asys.uv.Uv.close();
 		#end
 		#end
 	}
 	}
 }
 }