瀏覽代碼

added Lib.print and Lib.println (fixed #5593) (#5594)

* added Lib.print and Lib.println (fixed #5593)

* inline function and replace untyped

* remove untyped java
Matthijs Kamstra 8 年之前
父節點
當前提交
0417738353
共有 2 個文件被更改,包括 15 次插入1 次删除
  1. 1 1
      std/haxe/Log.hx
  2. 14 0
      std/java/Lib.hx

+ 1 - 1
std/haxe/Log.hx

@@ -96,7 +96,7 @@ class Log {
 			#if cs
 			cs.system.Console.WriteLine(str);
 			#elseif java
-			untyped __java__("java.lang.System.out.println(str)");
+			Sys.println(str);
 			#elseif lua
 			if (str == null) str = "null";
 			untyped __define_feature__("use._hx_print",_hx_print(str));

+ 14 - 0
std/java/Lib.hx

@@ -29,6 +29,20 @@ package java;
 @:native('haxe.java.Lib') class Lib
 {
 
+	/**
+		Print the specified value on the default output.
+	**/
+	inline public static function print( v : Dynamic ) : Void {
+		Sys.print(v);
+	}
+
+	/**
+		Print the specified value on the default output followed by a newline character.
+	**/
+	inline public static function println( v : Dynamic ) : Void {
+		Sys.println(v);
+	}
+
 	/**
 		Returns a native array from the supplied Array. This native array is unsafe to be written on,
 		as it may or may not be linked to the actual Array implementation.