2
0
tobil4sk 10 сар өмнө
parent
commit
526e57c40e

+ 1 - 1
haxe.opam

@@ -31,7 +31,7 @@ depends: [
   "conf-libpcre2-8"
   "conf-libpcre2-8"
   "conf-zlib"
   "conf-zlib"
   "conf-neko"
   "conf-neko"
-  "luv" {= "0.5.12"}
+  "luv" {>= "0.5.13"}
   "ipaddr"
   "ipaddr"
   "terminal_size"
   "terminal_size"
 ]
 ]

+ 4 - 4
src/macro/eval/evalLuv.ml

@@ -1942,7 +1942,7 @@ let fs_event_fields = [
 					) events
 					) events
 				in
 				in
 				encode_obj [
 				encode_obj [
-					key_file,vnative_string file;
+					key_file,encode_nullable vnative_string file;
 					key_events,encode_array vevents;
 					key_events,encode_array vevents;
 				]
 				]
 			) v4
 			) v4
@@ -2175,7 +2175,7 @@ let env_fields = [
 let time_fields = [
 let time_fields = [
 	"getTimeOfDay", vfun0 (fun() ->
 	"getTimeOfDay", vfun0 (fun() ->
 		encode_result (fun (t:Time.t) ->
 		encode_result (fun (t:Time.t) ->
-			encode_obj [key_sec,VInt64 t.tv_sec; key_usec,vint32 t.tv_usec]
+			encode_obj [key_sec,VInt64 t.sec; key_usec,vint32 t.usec]
 		) (Time.gettimeofday())
 		) (Time.gettimeofday())
 	);
 	);
 	"hrTime", vfun0 (fun() ->
 	"hrTime", vfun0 (fun() ->
@@ -2292,10 +2292,10 @@ let resource_fields = [
 		encode_array_a [|vfloat m1; vfloat m5; vfloat m15|];
 		encode_array_a [|vfloat m1; vfloat m5; vfloat m15|];
 	);
 	);
 	"freeMemory", vfun0 (fun() ->
 	"freeMemory", vfun0 (fun() ->
-		VUInt64 (Resource.free_memory())
+		encode_nullable (fun u -> VUInt64 u) (Resource.free_memory())
 	);
 	);
 	"totalMemory", vfun0 (fun() ->
 	"totalMemory", vfun0 (fun() ->
-		VUInt64 (Resource.total_memory())
+		encode_nullable (fun u -> VUInt64 u) (Resource.total_memory())
 	);
 	);
 	"constrainedMemory", vfun0 (fun() ->
 	"constrainedMemory", vfun0 (fun() ->
 		encode_nullable (fun u -> VUInt64 u) (Resource.constrained_memory())
 		encode_nullable (fun u -> VUInt64 u) (Resource.constrained_memory())

+ 1 - 1
std/eval/luv/FsEvent.hx

@@ -26,7 +26,7 @@ enum abstract FsEventFlag(Int) {
 	/**
 	/**
 		Starts the handle and watches the given path for changes.
 		Starts the handle and watches the given path for changes.
 	**/
 	**/
-	public function start(path:NativeString, ?flags:Array<FsEventFlag>, callback:(result:Result<{file:NativeString,events:Array<FsEventType>}>)->Void):Void;
+	public function start(path:NativeString, ?flags:Array<FsEventFlag>, callback:(result:Result<{file:Null<NativeString>,events:Array<FsEventType>}>)->Void):Void;
 
 
 	/**
 	/**
 		Stops the handle.
 		Stops the handle.

+ 4 - 2
std/eval/luv/Resource.hx

@@ -40,13 +40,15 @@ extern class Resource {
 
 
 	/**
 	/**
 		Evaluates to the amount of free memory, in bytes.
 		Evaluates to the amount of free memory, in bytes.
+		Returns `null` when unknown.
 	**/
 	**/
-	static function freeMemory():UInt64;
+	static function freeMemory():Null<UInt64>;
 
 
 	/**
 	/**
 		Evaluates to the total amount of memory, in bytes.
 		Evaluates to the total amount of memory, in bytes.
+		Returns `null` when unknown.
 	**/
 	**/
-	static function totalMemory():UInt64;
+	static function totalMemory():Null<UInt64>;
 
 
 	/**
 	/**
 		Gets the amount of memory available to the process (in bytes) based on
 		Gets the amount of memory available to the process (in bytes) based on