浏览代码

[js] remove haxe:trace (see #5639)

we might want to provide a legacy trace function in hx3compat
Dan Korostelev 8 年之前
父节点
当前提交
699214947f
共有 2 个文件被更改,包括 3 次插入23 次删除
  1. 2 8
      std/haxe/Log.hx
  2. 1 15
      std/js/Boot.hx

+ 2 - 8
std/haxe/Log.hx

@@ -61,7 +61,7 @@ class Log {
 				$print("\n");
 			}
 		#elseif js
-			untyped js.Boot.__trace(v,infos);
+			@:privateAccess js.Boot.__trace(v,infos);
 		#elseif (php && php7)
 			php.Boot.trace(v, infos);
 		#elseif php
@@ -120,20 +120,14 @@ class Log {
 		#end
 	}
 
-	#if (flash || js)
+	#if flash
 	/**
 		Clears the trace output.
 	**/
 	public static dynamic function clear() : Void {
-		#if flash
 		flash.Boot.__clear_trace();
-		#elseif js
-		@:privateAccess js.Boot.__clear_trace();
-		#end
 	}
-	#end
 
-	#if flash
 	/**
 		Sets the color of the trace output to `rgb`.
 	**/

+ 1 - 15
std/js/Boot.hx

@@ -40,10 +40,6 @@ private class HaxeError extends js.Error {
 @:dox(hide)
 class Boot {
 
-	private static function __unhtml(s : String) {
-		return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
-	}
-
 	private static function __trace(v,i : haxe.PosInfos) {
 		var msg = if (i != null) i.fileName + ":" + i.lineNumber + ": " else "";
 		msg += __string_rec(v, "");
@@ -51,20 +47,10 @@ class Boot {
 			for (v in i.customParams)
 				msg += "," + __string_rec(v, "");
 		var d;
-		if( js.Lib.typeof(untyped document) != "undefined" && (d = (untyped document).getElementById("haxe:trace")) != null )
-			d.innerHTML += __unhtml(msg)+"<br/>";
-		else if( js.Lib.typeof(untyped console) != "undefined" && (untyped console).log != null )
+		if( js.Lib.typeof(untyped console) != "undefined" && (untyped console).log != null )
 			(untyped console).log(msg);
 	}
 
-	private static function __clear_trace() {
-		untyped {
-			var d = document.getElementById("haxe:trace");
-			if( d != null )
-				d.innerHTML = "";
-		}
-	}
-
 	static inline function isClass(o:Dynamic) : Bool {
 		return untyped __define_feature__("js.Boot.isClass", o.__name__);
 	}