瀏覽代碼

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)