瀏覽代碼

removed TMember, added field access properties.

Nicolas Cannasse 19 年之前
父節點
當前提交
25fe6959f5
共有 4 個文件被更改,包括 7 次插入14 次删除
  1. 0 2
      genjs.ml
  2. 0 4
      genneko.ml
  3. 0 6
      genswf8.ml
  4. 7 2
      type.ml

+ 0 - 2
genjs.ml

@@ -136,7 +136,6 @@ and gen_expr ctx e =
 	match e.eexpr with
 	| TConst c -> gen_constant ctx c
 	| TLocal s -> spr ctx (ident s)
-	| TMember s -> print ctx "this%s" (field s)
 	| TEnumField (e,s) ->
 		print ctx "%s%s" (s_path e.e_path) (field s)
 	| TArray (e1,e2) -> 
@@ -402,7 +401,6 @@ and gen_value ctx e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TMember _
 	| TEnumField _
 	| TArray _
 	| TBinop _

+ 0 - 4
genneko.ml

@@ -170,8 +170,6 @@ and gen_call ctx p e el =
 			this p;
 			array p (List.map (gen_expr ctx) el)
 		]
-	| TMember s , el ->
-		call p (field p (this p) s) (List.map (gen_expr ctx) el)
 	| TField (e,f) , el ->
 		call p (field p (gen_expr ctx e) f) (List.map (gen_expr ctx) el)
 	| _ , _ ->
@@ -208,8 +206,6 @@ and gen_expr ctx e =
 			(EArray (ident p s,int p 0),p)
 		else
 			ident p s
-	| TMember s ->
-		gen_closure p e.etype (this p) s		
 	| TEnumField (e,f) ->
 		field p (gen_type_path p e.e_path) f
 	| TArray (e1,e2) ->

+ 0 - 6
genswf8.ml

@@ -487,11 +487,6 @@ let rec gen_access ctx forcall e =
 			VarReg 2
 	| TConst TThis ->
 		VarReg 1
-	| TMember f ->
-		push ctx [VReg 1; VStr f];
-		(match follow e.etype with
-		| TFun _ -> VarClosure
-		| _ -> VarObj)
 	| TLocal "__arguments__" ->
 		push ctx [VStr "arguments"];
 		VarStr
@@ -824,7 +819,6 @@ and gen_expr_2 ctx retval e =
 	| TField _
 	| TArray _
 	| TLocal _
-	| TMember _ 
 	| TType _
 	| TEnumField _ ->	
 		getvar ctx (gen_access ctx false e)

+ 7 - 2
type.ml

@@ -19,6 +19,11 @@
  
 type module_path = string list * string
 
+type field_access =
+	| NormalAccess
+	| NoAccess
+	| MethodAccess of string
+
 type t = 
 	| TMono of t option ref
 	| TEnum of tenum * t list
@@ -46,7 +51,6 @@ and tfunc = {
 and texpr_expr =
 	| TConst of tconstant
 	| TLocal of string
-	| TMember of string
 	| TEnumField of tenum * string
 	| TArray of texpr * texpr
 	| TBinop of Ast.binop * texpr * texpr
@@ -83,6 +87,8 @@ and tclass_field = {
 	mutable cf_type : t;
 	cf_public : bool;
 	cf_doc : Ast.documentation;
+	cf_get : field_access;
+	cf_set : field_access;
 	mutable cf_expr : texpr option;
 }
 
@@ -448,7 +454,6 @@ let rec iter f e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TMember _
 	| TEnumField _
 	| TBreak
 	| TContinue