Skip to content

Commit

Permalink
Generate dump even with --no-output
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jan 18, 2024
1 parent 979660d commit 5e91041
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ let compile ctx actx callbacks =
if is_compilation then Generate.check_auxiliary_output com actx;
enter_stage com CGenerationStart;
ServerMessage.compiler_stage com;
Generate.maybe_generate_dump ctx tctx;
if not actx.no_output then Generate.generate ctx tctx ext actx;
enter_stage com CGenerationDone;
ServerMessage.compiler_stage com;
Expand Down
15 changes: 9 additions & 6 deletions src/compiler/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ let parse_swf_header ctx h = match ExtString.String.nsplit h ":" with

let delete_file f = try Sys.remove f with _ -> ()

let generate ctx tctx ext actx =
let maybe_generate_dump ctx tctx =
let com = tctx.Typecore.com in
(* check file extension. In case of wrong commandline, we don't want
to accidentaly delete a source file. *)
if Path.file_extension com.file = ext then delete_file com.file;
if com.platform = Flash || com.platform = Cpp || com.platform = Hl then List.iter (Codegen.fix_overrides com) com.types;
if Common.defined com Define.Dump then begin
Codegen.Dump.dump_types com;
Option.may Codegen.Dump.dump_types (com.get_macros())
Expand All @@ -110,7 +106,14 @@ let generate ctx tctx ext actx =
if not com.is_macro_context then match tctx.Typecore.g.Typecore.macros with
| None -> ()
| Some(_,ctx) -> Codegen.Dump.dump_dependencies ~target_override:(Some "macro") ctx.Typecore.com
end;
end

let generate ctx tctx ext actx =
let com = tctx.Typecore.com in
(* check file extension. In case of wrong commandline, we don't want
to accidentaly delete a source file. *)
if Path.file_extension com.file = ext then delete_file com.file;
if com.platform = Flash || com.platform = Cpp || com.platform = Hl then List.iter (Codegen.fix_overrides com) com.types;
begin match com.platform with
| Neko | Hl | Eval when actx.interp -> ()
| Cpp when Common.defined com Define.Cppia -> ()
Expand Down

0 comments on commit 5e91041

Please sign in to comment.