Ver Fonte

[js] fix tracing (closes #6492)

Simon Krajewski há 8 anos atrás
pai
commit
3e8f9e5982
1 ficheiros alterados com 6 adições e 4 exclusões
  1. 6 4
      src/generators/genjs.ml

+ 6 - 4
src/generators/genjs.ml

@@ -423,15 +423,17 @@ let rec gen_call ctx e el in_value =
 			spr ctx ")";
 		end else begin
 			spr ctx "console.log(";
-			begin match infos.eexpr with
+			let b = match infos.eexpr with
 			| TObjectDecl (
 				("fileName" , { eexpr = (TConst (TString file)) }) ::
 				("lineNumber" , { eexpr = (TConst (TInt line)) }) :: _) ->
-					print ctx "\"%s:%i: \" + " file (Int32.to_int line);
+					print ctx "\"%s:%i: \" + (" file (Int32.to_int line);
+					true
 			| _ ->
-				()
-			end;
+				false
+			in
 			gen_value ctx e;
+			if b then spr ctx ")";
 			spr ctx ")";
 		end
 	| _ ->