Просмотр исходного кода

Update target config after init macros (#11985)

* Update target config after init macros

* [tests] add test
Rudy Ges 8 месяцев назад
Родитель
Сommit
0ee1a66354

+ 1 - 0
src/compiler/compiler.ml

@@ -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

+ 1 - 0
tests/misc/js/projects/Issue11985/.gitignore

@@ -0,0 +1 @@
+test.js

+ 3 - 0
tests/misc/js/projects/Issue11985/Macro.hx

@@ -0,0 +1,3 @@
+function init() {
+	haxe.macro.Compiler.define("js-unflatten", "1");
+}

+ 4 - 0
tests/misc/js/projects/Issue11985/Main.hx

@@ -0,0 +1,4 @@
+function main() {
+	haxe.Log.trace("hello");
+	var haxe = "haxe";
+}

+ 4 - 0
tests/misc/js/projects/Issue11985/compile.hxml

@@ -0,0 +1,4 @@
+-main Main
+--macro Macro.init()
+-js test.js
+-cmd "node test.js"