Skip to content

Commit

Permalink
[js] define console in non-es5 mode (closes HaxeFoundation#3245)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyli committed Sep 18, 2014
1 parent 04522a4 commit 6a030af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions genjs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,8 @@ let generate com =
List.iter (fun f -> print_obj f "$hx_exports") exposedObject.os_fields;
end;

(* if not (Common.defined com Define.JsEs5) then
spr ctx "if(typeof(console) == \"undefined\") var console = {log:function(){}};\n"; *)
if not (Common.defined com Define.JsEs5) then
spr ctx "var console = (1,eval)('this').console || {log:function(){}};\n";
(* TODO: fix $estr *)
let vars = [] in
let vars = (if has_feature ctx "Type.resolveClass" || has_feature ctx "Type.resolveEnum" then ("$hxClasses = " ^ (if ctx.js_modern then "{}" else "$hxClasses || {}")) :: vars else vars) in
Expand Down

0 comments on commit 6a030af

Please sign in to comment.