Merge pull request #1439 from BrzVlad/feature-managed-allocator
[mono.git] / mcs / mcs / flowanalysis.cs
index dbb74a7515a0d930a37c4832521afe6acb04c247..da30a3e5b907570cd2453f3c40761e43935c5f29 100644 (file)
@@ -105,7 +105,7 @@ namespace Mono.CSharp
                        return struct_info.GetStructField (name);
                }
 
-               public static TypeInfo GetTypeInfo (TypeSpec type)
+               public static TypeInfo GetTypeInfo (TypeSpec type, IMemberContext context)
                {
                        if (!type.IsStruct)
                                return simple_type;
@@ -114,7 +114,7 @@ namespace Mono.CSharp
                        if (type_hash.TryGetValue (type, out info))
                                return info;
 
-                       var struct_info = StructInfo.GetStructInfo (type);
+                       var struct_info = StructInfo.GetStructInfo (type, context);
                        if (struct_info != null) {
                                info = new TypeInfo (struct_info, 0);
                        } else {
@@ -139,7 +139,7 @@ namespace Mono.CSharp
                                var field = struct_info.Fields[i];
 
                                if (!fc.IsStructFieldDefinitelyAssigned (vi, field.Name)) {
-                                       var bf = field.MemberDefinition as Property.BackingField;
+                                       var bf = field.MemberDefinition as Property.BackingFieldDeclaration;
                                        if (bf != null) {
                                                if (bf.Initializer != null)
                                                        continue;
@@ -184,11 +184,11 @@ namespace Mono.CSharp
                        //
                        // We only need one instance per type
                        //
-                       StructInfo (TypeSpec type)
+                       StructInfo (TypeSpec type, IMemberContext context)
                        {
                                field_type_hash.Add (type, this);
 
-                               fields = MemberCache.GetAllFieldsForDefiniteAssignment (type);
+                               fields = MemberCache.GetAllFieldsForDefiniteAssignment (type, context);
 
                                struct_field_hash = new Dictionary<string, TypeInfo> ();
                                field_hash = new Dictionary<string, int> (fields.Count);
@@ -202,7 +202,7 @@ namespace Mono.CSharp
                                        var field = fields [i];
 
                                        if (field.MemberType.IsStruct)
-                                               sinfo [i] = GetStructInfo (field.MemberType);
+                                               sinfo [i] = GetStructInfo (field.MemberType, context);
 
                                        if (sinfo [i] == null)
                                                field_hash.Add (field.Name, ++Length);
@@ -260,7 +260,7 @@ namespace Mono.CSharp
                                return null;
                        }
 
-                       public static StructInfo GetStructInfo (TypeSpec type)
+                       public static StructInfo GetStructInfo (TypeSpec type, IMemberContext context)
                        {
                                if (type.BuiltinType > 0)
                                        return null;
@@ -269,7 +269,7 @@ namespace Mono.CSharp
                                if (field_type_hash.TryGetValue (type, out info))
                                        return info;
 
-                               return new StructInfo (type);
+                               return new StructInfo (type, context);
                        }
                }
        }
@@ -305,11 +305,11 @@ namespace Mono.CSharp
 
                VariableInfo[] sub_info;
 
-               VariableInfo (string name, TypeSpec type, int offset)
+               VariableInfo (string name, TypeSpec type, int offset, IMemberContext context)
                {
                        this.Name = name;
                        this.Offset = offset;
-                       this.TypeInfo = TypeInfo.GetTypeInfo (type);
+                       this.TypeInfo = TypeInfo.GetTypeInfo (type, context);
 
                        Length = TypeInfo.TotalLength;
 
@@ -343,14 +343,14 @@ namespace Mono.CSharp
 
                public static VariableInfo Create (BlockContext bc, LocalVariable variable)
                {
-                       var info = new VariableInfo (variable.Name, variable.Type, bc.AssignmentInfoOffset);
+                       var info = new VariableInfo (variable.Name, variable.Type, bc.AssignmentInfoOffset, bc);
                        bc.AssignmentInfoOffset += info.Length;
                        return info;
                }
 
                public static VariableInfo Create (BlockContext bc, Parameter parameter)
                {
-                       var info = new VariableInfo (parameter.Name, parameter.Type, bc.AssignmentInfoOffset) {
+                       var info = new VariableInfo (parameter.Name, parameter.Type, bc.AssignmentInfoOffset, bc) {
                                IsParameter = true
                        };
 
@@ -669,7 +669,7 @@ namespace Mono.CSharp
                                large_bits[index >> 5] |= (1 << (index & 31));
                }
 
-               static bool AreEqual (DefiniteAssignmentBitSet a, DefiniteAssignmentBitSet b)
+               public static bool AreEqual (DefiniteAssignmentBitSet a, DefiniteAssignmentBitSet b)
                {
                        if (a.large_bits == null)
                                return (a.bits & ~copy_on_write_flag) == (b.bits & ~copy_on_write_flag);