[mcs] Implements C# 7.2 readonly structs
[mono.git] / mcs / mcs / import.cs
index 719ba23952cd714f0021ef68335b081af7a94640..1cddf7c01f4b8478f80c0a158e47a25a1b688873 100644 (file)
@@ -959,7 +959,8 @@ namespace Mono.CSharp
                                        }
                                }
 
-                               if (kind == MemberKind.Class) {
+                               switch (kind) {
+                               case MemberKind.Class:
                                        if ((ma & TypeAttributes.Sealed) != 0) {
                                                if ((ma & TypeAttributes.Abstract) != 0)
                                                        mod |= Modifiers.STATIC;
@@ -968,6 +969,13 @@ namespace Mono.CSharp
                                        } else if ((ma & TypeAttributes.Abstract) != 0) {
                                                mod |= Modifiers.ABSTRACT;
                                        }
+                                       break;
+                               case MemberKind.Struct:
+                                       if (HasAttribute (CustomAttributeData.GetCustomAttributes (type), "IsReadOnlyAttribute", CompilerServicesNamespace)) {
+                                               mod |= Modifiers.READONLY;
+                                       }
+
+                                       break;
                                }
                        }