浏览代码

[php7] use is_extern_var instead of own invention

Alexander Kuzmenko 8 年之前
父节点
当前提交
009b57692d
共有 1 个文件被更改,包括 1 次插入21 次删除
  1. 1 21
      src/generators/genphp7.ml

+ 1 - 21
src/generators/genphp7.ml

@@ -764,26 +764,6 @@ let has_rtti_meta ctx mtype =
 		| None -> false
 		| Some _ -> true
 
-(**
-	Check if specified property access requires a real class variable to be defined.
-*)
-let is_real_var_access access =
-	match access with
-		| AccNormal
-		| AccNo -> true
-		| _ -> false
-
-(**
-	Check if this var accesses and meta combination should generate a variable
-*)
-let is_real_var field =
-	if Meta.has IsVar field.cf_meta then
-		true
-	else
-		match field.cf_kind with
-			| Var { v_read = read; v_write = write } -> is_real_var_access read || is_real_var_access write
-			| _ -> false
-
 (**
 	Check if user-defined field has the same name as one of php magic methods, but with not compatible signature.
 *)
@@ -3483,7 +3463,7 @@ class class_builder ctx (cls:tclass) =
 		method private write_field is_static field =
 			match field.cf_kind with
 				| Var { v_read = AccInline; v_write = AccNever } -> self#write_const field
-				| Var _ when is_real_var field ->
+				| Var _ when not (is_extern_field field) ->
 					(* Do not generate fields for RTTI meta, because this generator uses another way to store it *)
 					let is_auto_meta_var = is_static && field.cf_name = "__meta__" && (has_rtti_meta ctx wrapper#get_module_type) in
 					if not is_auto_meta_var then self#write_var field is_static;