Browse Source

added -D haxe3compat (close #6375)

ncannasse 8 years ago
parent
commit
d45aa841dc
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/typing/typer.ml

+ 1 - 0
src/typing/typer.ml

@@ -1059,6 +1059,7 @@ let field_access ctx mode f fmode t e p =
 			in
 			if m = ctx.curfield.cf_name && (match e.eexpr with TConst TThis -> true | TLocal v -> Option.map_default (fun vthis -> v == vthis) false ctx.vthis | TTypeExpr (TClassDecl c) when c == ctx.curclass -> true | _ -> false) then
 				let prefix = (match ctx.com.platform with Flash when Common.defined ctx.com Define.As3 -> "$" | _ -> "") in
+				(match e.eexpr with TLocal _ when Common.defined ctx.com Define.Haxe3Compat -> ctx.com.warning "Field set has changed here in Haxe 4: call setter explicitly to keep Haxe 3.x behaviour" p | _ -> ());
 				if not (is_physical_field f) then begin
 					display_error ctx "This field cannot be accessed because it is not a real variable" p;
 					display_error ctx "Add @:isVar here to enable it" f.cf_pos;