Browse Source

Add "console" to JS keywords.

Bad things happen if you define a local var called console and then use
trace(). This along with the window keywording is going to break a lot
of code though.
Bruno Garcia 12 years ago
parent
commit
9711aad6ab
2 changed files with 3 additions and 3 deletions
  1. 1 1
      genjs.ml
  2. 2 2
      std/js/Boot.hx

+ 1 - 1
genjs.ml

@@ -82,7 +82,7 @@ let kwds =
 		"void"; "while"; "with"; "yield";
 		"void"; "while"; "with"; "yield";
 
 
 		(* Identifiers Haxe reserves to make the JS output cleaner. *)
 		(* Identifiers Haxe reserves to make the JS output cleaner. *)
-		"window";
+		"console"; "window";
 	];
 	];
 
 
 
 

+ 2 - 2
std/js/Boot.hx

@@ -41,8 +41,8 @@ class Boot {
 			var d;
 			var d;
 			if( __js__("typeof")(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null )
 			if( __js__("typeof")(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null )
 				d.innerHTML += __unhtml(msg)+"<br/>";
 				d.innerHTML += __unhtml(msg)+"<br/>";
-			else if( __js__("typeof")(console) != "undefined" && console.log != null )
-				console.log(msg);
+			else if( __js__("typeof console") != "undefined" && __js__("console").log != null )
+				__js__("console").log(msg);
 			#end
 			#end
 		}
 		}
 	}
 	}