Browse Source

[cs] Add @:readOnly meta to the loaded .NET readonly fields (somewhat related to #4598)

Dan Korostelev 9 years ago
parent
commit
921b4c6315
2 changed files with 2 additions and 0 deletions
  1. 1 0
      gencs.ml
  2. 1 0
      tests/unit/native_cs/src/haxe/test/MyClass.cs

+ 1 - 0
gencs.ml

@@ -3604,6 +3604,7 @@ let convert_ilfield ctx p field =
 		Printf.printf "\t%sfield %s : %s\n" (if List.mem AStatic acc then "static " else "") cff_name (IlMetaDebug.ilsig_s field.fsig.ssig);
 		Printf.printf "\t%sfield %s : %s\n" (if List.mem AStatic acc then "static " else "") cff_name (IlMetaDebug.ilsig_s field.fsig.ssig);
 	let kind = match readonly with
 	let kind = match readonly with
 		| true ->
 		| true ->
+			cff_meta := (Meta.ReadOnly, [], cff_pos) :: !cff_meta;
 			FProp ("default", "never", Some (convert_signature ctx p field.fsig.snorm), None)
 			FProp ("default", "never", Some (convert_signature ctx p field.fsig.snorm), None)
 		| false ->
 		| false ->
 			FVar (Some (convert_signature ctx p field.fsig.snorm), None)
 			FVar (Some (convert_signature ctx p field.fsig.snorm), None)

+ 1 - 0
tests/unit/native_cs/src/haxe/test/MyClass.cs

@@ -82,6 +82,7 @@ public class MyClass
 			voidvoid2.Invoke();
 			voidvoid2.Invoke();
 	}
 	}
 
 
+	public readonly int readonlyField = 5;
 }
 }
 
 
 public delegate void VoidVoid();
 public delegate void VoidVoid();