From 76d4e1bb8762cd237898908a69c87c8704b853de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Thu, 14 Mar 2019 18:54:36 +0100 Subject: [PATCH] Distinguish function application from constructor application --- AST2.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AST2.ml b/AST2.ml index 0760671f0..e66f7591c 100644 --- a/AST2.ml +++ b/AST2.ml @@ -468,7 +468,13 @@ and s_loop : I.loop -> O.instr list = function and s_fun_call {value=(fun_name, arguments); region} : O.expr = let () = ignore (region) in - App { operator = Function (s_name fun_name); arguments = s_arguments arguments } + let {value=fun_name_string;_} = fun_name in + let firstchar = String.sub fun_name_string 0 1 in + (* If it starts with a capital letter, then it is a constructor *) + if String.equal firstchar (String.uppercase_ascii firstchar) then + App { operator = Constructor (s_name fun_name); arguments = s_arguments arguments } + else + App { operator = Function (s_name fun_name); arguments = s_arguments arguments } and s_constr_app {value=(constr, arguments); region} : O.expr = let () = ignore (region) in