From c64c4ab2526ad87a3506c9e1fdf31fa1446c16eb Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 22 Aug 2016 17:59:02 +0200 Subject: Reuse env from during parameter elaboration. Allows adding struct definitions in function parameters. Bug 19602. --- cparser/Elab.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cparser') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 76a7379c..d04d5638 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -640,7 +640,7 @@ and elab_type_declarator loc env ty kr_ok = function error loc "Illegal function return type@ %a" Cprint.typ ty | _ -> () end; - let params' = elab_parameters env params in + let params',env = elab_parameters env params in elab_type_declarator loc env (TFun(ty, Some params', vararg, [])) kr_ok d | Cabs.PROTO_OLD(d, params) -> begin match unroll env ty with @@ -660,11 +660,11 @@ and elab_type_declarator loc env ty kr_ok = function and elab_parameters env params = (* Prototype introduces a new scope *) - let (vars, _) = mmap elab_parameter (Env.new_scope env) params in + let (vars, env) = mmap elab_parameter (Env.new_scope env) params in (* Catch special case f(t) where t is void or a typedef to void *) match vars with - | [ ( {C.name=""}, t) ] when is_void_type env t -> [] - | _ -> vars + | [ ( {C.name=""}, t) ] when is_void_type env t -> [],env + | _ -> vars,env (* Elaboration of a function parameter *) -- cgit