Skip to content

Commit

Permalink
Update target config after init macros (#11985)
Browse files Browse the repository at this point in the history
* Update target config after init macros

* [tests] add test
  • Loading branch information
kLabz authored Feb 10, 2025
1 parent 9d32634 commit 0ee1a66
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ let do_type ctx mctx actx display_file_dot_path =
Some (MacroContext.call_init_macro ctx.com mctx path)
) mctx (List.rev actx.config_macros) in
enter_stage com CInitMacrosDone;
update_platform_config com; (* make sure to adapt all flags changes defined during init macros *)
ServerMessage.compiler_stage com;

let macros = match mctx with None -> None | Some mctx -> mctx.g.macros in
Expand Down
1 change: 1 addition & 0 deletions tests/misc/js/projects/Issue11985/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test.js
3 changes: 3 additions & 0 deletions tests/misc/js/projects/Issue11985/Macro.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function init() {
haxe.macro.Compiler.define("js-unflatten", "1");
}
4 changes: 4 additions & 0 deletions tests/misc/js/projects/Issue11985/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function main() {
haxe.Log.trace("hello");
var haxe = "haxe";
}
4 changes: 4 additions & 0 deletions tests/misc/js/projects/Issue11985/compile.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-main Main
--macro Macro.init()
-js test.js
-cmd "node test.js"

0 comments on commit 0ee1a66

Please sign in to comment.