Quellcode durchsuchen

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

Simon Krajewski vor 5 Jahren
Ursprung
Commit
99a6663306
4 geänderte Dateien mit 10 neuen und 15 gelöschten Zeilen
  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";"uv";"_UVErrorType"],"UVErrorType_Impl_") (uv_statics (Uv.get_errno())) [];
 	init_fields builtins (["eval";"uv"],"File") [] [];
-	init_fields builtins (["eval"],"Uv") [
+	init_fields builtins (["asys";"uv"],"Uv") [
 		"init",StdUv.init;
 		"run",StdUv.run;
 		"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
 				mk (TCall (mk (TField (et,FStatic (ec,ef))) ef.cf_type p,[])) ctx.t.tvoid p
 			in
-			let init = mk_call "init" in
 			let run = mk_call "run" 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 ->
 			main
 		) in

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

@@ -1,8 +1,12 @@
-package eval;
+package asys.uv;
 
 extern class Uv {
 	static function init():Void;
 	static function run(mode:asys.uv.UVRunMode):Bool;
 	static function stop():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;
 	}
 
-	@: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.
 	**/
@@ -137,9 +131,7 @@ class EntryPoint {
 		#elseif flash
 		flash.Lib.current.stage.addEventListener(flash.events.Event.ENTER_FRAME, function(_) processEvents());
 		#elseif target.asys
-		#if eval
-		eval.Uv.run(RunDefault);
-		#end
+		asys.uv.Uv.run(RunDefault);
 		#elseif sys
 		while (true) {
 			var nextTick = processEvents();
@@ -154,8 +146,8 @@ class EntryPoint {
 	}
 
 	@:keep static public function close() {
-		#if eval
-		eval.Uv.close();
+		#if target.asys
+		asys.uv.Uv.close();
 		#end
 	}
 }