Browse Source

do not inline field access in display mode (closes #2997)

Simon Krajewski 9 years ago
parent
commit
d5dfb1c8fb

+ 12 - 0
tests/misc/projects/Issue2997/Main.hx

@@ -0,0 +1,12 @@
+@:enum abstract MyEnum(Int) {
+    var A = 1;
+    var B = 2;
+    var C = 3;
+}
+
+class Main {
+    static function main() {
+        var a = A;
+        var b = MyEnum.B;
+    }
+}

+ 1 - 0
tests/misc/projects/Issue2997/compile1.hxml

@@ -0,0 +1 @@
+--display Main.hx@138@position

+ 3 - 0
tests/misc/projects/Issue2997/compile1.hxml.stderr

@@ -0,0 +1,3 @@
+<list>
+<pos>c:\github\haxe\tests\misc\projects\issue2997\main.hx:2: characters 4-14</pos>
+</list>

+ 2 - 0
typer.ml

@@ -1034,6 +1034,8 @@ let rec acc_get ctx g p =
 				mk (TField (e,cmode)) t p
 			else
 				error "Recursive inline is not supported" p
+		| Some _ when ctx.com.display <> DMNone ->
+			mk (TField (e,cmode)) t p
 		| Some { eexpr = TFunction _ } ->
 			let chk_class c = (c.cl_extern || Meta.has Meta.Extern f.cf_meta) && not (Meta.has Meta.Runtime f.cf_meta) in
 			let wrap_extern c =