浏览代码

Properly escape php get/set fields

* Properly escape php get/set fields

* Test added for issue 4810

* Fix Issue4180.hx test formatting
Ben Merckx 9 年之前
父节点
当前提交
1d91d47c05
共有 2 个文件被更改,包括 12 次插入2 次删除
  1. 2 2
      src/generators/genphp.ml
  2. 10 0
      tests/unit/src/unit/issues/Issue4810.hx

+ 2 - 2
src/generators/genphp.ml

@@ -1896,13 +1896,13 @@ let generate_field ctx static f =
 				| AccCall, _ ->
 					let m = "get_" ^ f.cf_name in
 					if not (is_method_defined ctx m static) then generate_self_method ctx rights m static false;
-					print ctx "%s $%s" rights (s_ident_field f.cf_name);
+					print ctx "%s $%s" rights (s_ident f.cf_name);
 					gen_assigned_value ctx f.cf_expr;
 					true
 				| _, AccCall ->
 					let m = "set_" ^ f.cf_name in
 					if not (is_method_defined ctx m static) then generate_self_method ctx rights m static true;
-					print ctx "%s $%s" rights (s_ident_field f.cf_name);
+					print ctx "%s $%s" rights (s_ident f.cf_name);
 					gen_assigned_value ctx f.cf_expr;
 					true
 				| _ ->

+ 10 - 0
tests/unit/src/unit/issues/Issue4810.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue4810 extends Test {
+	static public var DEFAULT(get, null): Bool;
+	static function get_DEFAULT()
+		return true;
+	function test() {
+		eq(true, DEFAULT);
+	}
+}