Просмотр исходного кода

[compiler] deal with no args case

Simon Krajewski 3 лет назад
Родитель
Сommit
1e280b5bb7
1 измененных файлов с 13 добавлено и 16 удалено
  1. 13 16
      src/compiler/compiler.ml

+ 13 - 16
src/compiler/compiler.ml

@@ -589,22 +589,19 @@ module HighLevel = struct
 			| _ ->
 				args
 		in
-		let rec loop args = match args with
-			| [] ->
-				0
-			| args ->
-				let args,server_mode,ctx = try
-					process_params server_api create each_args !has_display args
-				with Arg.Bad msg ->
-					let ctx = create 0 args in
-					error ctx ("Error: " ^ msg) null_pos;
-					[],SMNone,ctx
-				in
-				let code = execute_ctx server_api ctx server_mode in
-				if code = 0 then
-					loop args
-				else
-					code
+		let rec loop args =
+			let args,server_mode,ctx = try
+				process_params server_api create each_args !has_display args
+			with Arg.Bad msg ->
+				let ctx = create 0 args in
+				error ctx ("Error: " ^ msg) null_pos;
+				[],SMNone,ctx
+			in
+			let code = execute_ctx server_api ctx server_mode in
+			if code = 0 && args <> [] then
+				loop args
+			else
+				code
 		in
 		let code = loop args in
 		comm.exit code