瀏覽代碼

[js] fix tracing (closes #6492)

Simon Krajewski 8 年之前
父節點
當前提交
3e8f9e5982
共有 1 個文件被更改,包括 6 次插入4 次删除
  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
 	| _ ->