فهرست منبع

allowed direct property access in getter/setter

Nicolas Cannasse 19 سال پیش
والد
کامیت
e763ea7707
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  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)