瀏覽代碼

[cs] Native protected setters should be set as "never". Closes #4325

Cauê Waneck 10 年之前
父節點
當前提交
aac1718575
共有 3 個文件被更改,包括 16 次插入1 次删除
  1. 1 1
      gencs.ml
  2. 7 0
      tests/unit/native_cs/src/haxe/test/Base.cs
  3. 8 0
      tests/unit/src/unit/TestCSharp.hx

+ 1 - 1
gencs.ml

@@ -3813,7 +3813,7 @@ let convert_ilprop ctx p prop is_explicit_impl =
 			raise Exit (* special (?) getter; not used *)
 			raise Exit (* special (?) getter; not used *)
 		| Some(_,m) when access m <> FAPublic -> (match access m with
 		| Some(_,m) when access m <> FAPublic -> (match access m with
 			| FAFamily
 			| FAFamily
-			| FAFamOrAssem -> "null"
+			| FAFamOrAssem -> "never"
 			| _ -> "never");
 			| _ -> "never");
 		| Some _ -> "set"
 		| Some _ -> "set"
 	in
 	in

+ 7 - 0
tests/unit/native_cs/src/haxe/test/Base.cs

@@ -39,6 +39,13 @@ public class Base
 		get { return i * 20; }
 		get { return i * 20; }
 	}
 	}
 
 
+	public int Issue4325 { get; protected set; }
+
+	public void setIssue4325(int val)
+	{
+		this.Issue4325 = val;
+	}
+
 	public int this[int i, int j]
 	public int this[int i, int j]
 	{
 	{
 		get { return i * j; }
 		get { return i * j; }

+ 8 - 0
tests/unit/src/unit/TestCSharp.hx

@@ -24,6 +24,14 @@ class TestCSharp extends Test
 {
 {
 #if cs
 #if cs
 
 
+	function testIssue4325()
+	{
+		var b = new Base();
+		eq(b.Issue4325, 0);
+		b.setIssue4325(10);
+		eq(b.Issue4325, 10);
+	}
+
 	// -net-lib tests
 	// -net-lib tests
 	function testHaxeKeywords()
 	function testHaxeKeywords()
 	{
 	{