浏览代码

fixed minor bugs.

Nicolas Cannasse 19 年之前
父节点
当前提交
111aab93e1
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      genneko.ml

+ 4 - 3
genneko.ml

@@ -365,7 +365,7 @@ and gen_expr ctx e =
 							b();
 							(EBlock [
 								(EVars ["@tmp",Some (field p (ident p "@tmp") "args")],p);
-								(EVars vars,p);
+								(match vars with [] -> null p | _ -> EVars vars,p);
 								e2
 							],p)
 					in
@@ -601,10 +601,11 @@ let generate file types hres =
 	let ch = IO.output_channel (open_out neko_file) in
 	(if !Plugin.verbose then Nxml.write_fmt else Nxml.write) ch (Nxml.to_xml e);
 	IO.close_out ch;
+	let command cmd = try Sys.command cmd with _ -> -1 in
 	if !Plugin.verbose then begin
-		if Sys.command ("nekoc -p " ^ neko_file) <> 0 then failwith "Failed to print neko code";
+		if command ("nekoc -p " ^ neko_file) <> 0 then failwith "Failed to print neko code";
 		Sys.remove neko_file;
 		Sys.rename (Filename.chop_extension file ^ "2.neko") neko_file;
 	end;
-	if Sys.command ("nekoc " ^ neko_file) <> 0 then failwith "Neko compilation failure";
+	if command ("nekoc " ^ neko_file) <> 0 then failwith "Neko compilation failure";
 	if not !Plugin.verbose then Sys.remove neko_file