Browse Source

allowed direct property access in getter/setter

Nicolas Cannasse 19 năm trước cách đây
mục cha
commit
e763ea7707
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      typer.ml

+ 3 - 1
typer.ml

@@ -231,7 +231,9 @@ let field_access ctx get f t e p =
 	| NormalAccess ->
 		AccExpr (mk (TField (e,f.cf_name)) t p)
 	| MethodAccess m ->
-		if get then
+		if m = ctx.curmethod && e.eexpr = TConst TThis then
+			AccExpr (mk (TField (e,f.cf_name)) t p)
+		else if get then
 			AccExpr (mk (TCall (mk (TField (e,m)) (mk_mono()) p,[])) t p)
 		else
 			AccSet (e,m,t,f.cf_name)