Răsfoiți Sursa

change diagnostics handling again

Maybe the secret is to flush PBuildClass so everything has a structure?
Simon Krajewski 9 ani în urmă
părinte
comite
b7e903b057
2 a modificat fișierele cu 18 adăugiri și 3 ștergeri
  1. 0 3
      src/main.ml
  2. 18 0
      src/typing/typeload.ml

+ 0 - 3
src/main.ml

@@ -1612,9 +1612,6 @@ try
 		com.modules <- modules;
 		begin match com.display with
 			| DMUsage -> Codegen.detect_usage com;
-			| DMDiagnostics ->
-				Codegen.DeprecationCheck.run com;
-				raise (Display.Diagnostics (Display.Diagnostics.print_diagnostics ctx.com))
 			| _ -> ()
 		end;
 		Filters.run com tctx main;

+ 18 - 0
src/typing/typeload.ml

@@ -3485,6 +3485,24 @@ let type_module ctx mpath file ?(is_extern=false) tdecls p =
 	let ctx = type_types_into_module ctx m tdecls p in
 	if is_extern then m.m_extra.m_kind <- MExtern;
 	begin if ctx.is_display_file then match ctx.com.display with
+		| DMDiagnostics ->
+			flush_pass ctx PBuildClass "diagnostics";
+			List.iter (fun mt -> match mt with
+				| TClassDecl c | TAbstractDecl({a_impl = Some c}) ->
+					ignore(c.cl_build());
+					let field cf = match cf.cf_kind with
+						| Method MethMacro ->
+							(try ignore (ctx.g.do_macro ctx MDisplay c.cl_path cf.cf_name [] p) with Exit -> ())
+						| _ ->
+							ignore(follow cf.cf_type);
+					in
+					List.iter field c.cl_ordered_fields;
+					List.iter field c.cl_ordered_statics;
+					(match c.cl_constructor with None -> () | Some cf -> field cf);
+				| _ ->
+					()
+			) m.m_types;
+			raise (Display.Diagnostics (Display.Diagnostics.print_diagnostics ctx.com))
 		| DMResolve s ->
 			resolve_position_by_path ctx {tname = s; tpackage = []; tsub = None; tparams = []} p
 		| _ ->