Selaa lähdekoodia

run analyzer again after adding field inits (closes #3704)

Simon Krajewski 9 vuotta sitten
vanhempi
commit
7c4fd45415
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      filters.ml

+ 7 - 3
filters.ml

@@ -848,7 +848,7 @@ let add_field_inits ctx t =
 						eassign;
 			) inits in
 			let el = if !need_this then (mk (TVar((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
-			match c.cl_constructor with
+			let cf = match c.cl_constructor with
 			| None ->
 				let ct = TFun([],ctx.com.basic.tvoid) in
 				let ce = mk (TFunction {
@@ -858,15 +858,19 @@ let add_field_inits ctx t =
 				}) ct c.cl_pos in
 				let ctor = mk_field "new" ct c.cl_pos in
 				ctor.cf_kind <- Method MethNormal;
-				c.cl_constructor <- Some { ctor with cf_expr = Some ce };
+				{ ctor with cf_expr = Some ce }
 			| Some cf ->
 				match cf.cf_expr with
 				| Some { eexpr = TFunction f } ->
 					let bl = match f.tf_expr with {eexpr = TBlock b } -> b | x -> [x] in
 					let ce = mk (TFunction {f with tf_expr = mk (TBlock (el @ bl)) ctx.com.basic.tvoid c.cl_pos }) cf.cf_type cf.cf_pos in
-					c.cl_constructor <- Some {cf with cf_expr = Some ce }
+					{cf with cf_expr = Some ce };
 				| _ ->
 					assert false
+			in
+			let config = Analyzer.Config.get_base_config ctx.com false in
+			Analyzer.Run.run_on_field ctx config c cf;
+			c.cl_constructor <- Some cf
 	in
 	match t with
 	| TClassDecl c ->