Browse Source

deal with module fields in Compiler.exclude

closes #11688
Simon Krajewski 9 months ago
parent
commit
5b757af567

+ 7 - 1
std/haxe/macro/Compiler.hx

@@ -266,7 +266,13 @@ class Compiler {
 				switch (t) {
 					case TInst(c, _):
 						name = c.toString();
-						b = c.get();
+						var c = c.get();
+						switch (c.kind) {
+							case KModuleFields(module):
+								name = module;
+							case _:
+						}
+						b = c;
 					case TEnum(e, _):
 						name = e.toString();
 						b = e.get();

+ 3 - 0
tests/misc/projects/Issue11688/Foo.hx

@@ -0,0 +1,3 @@
+function foo() {
+	trace("hello foo");
+}

+ 3 - 0
tests/misc/projects/Issue11688/Main.hx

@@ -0,0 +1,3 @@
+function main() {
+	Foo.foo();
+}

+ 3 - 0
tests/misc/projects/Issue11688/compile-fail.hxml

@@ -0,0 +1,3 @@
+--main Main
+--macro exclude('Foo')
+--interp

+ 1 - 0
tests/misc/projects/Issue11688/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Field index for foo not found on prototype _Foo.Foo_Fields_