diff options
Diffstat (limited to 'mcs/mcs/class.cs')
-rw-r--r-- | mcs/mcs/class.cs | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs index d6e1e8ed2c..d450030d74 100644 --- a/mcs/mcs/class.cs +++ b/mcs/mcs/class.cs @@ -13,6 +13,7 @@ // using System; +using System.Linq; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security; @@ -53,7 +54,11 @@ namespace Mono.CSharp protected bool is_defined; - public TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) + public int CounterAnonymousMethods { get; set; } + public int CounterAnonymousContainers { get; set; } + public int CounterSwitchTypes { get; set; } + + protected TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) : base (parent, name, attrs) { this.Kind = kind; @@ -556,7 +561,7 @@ namespace Mono.CSharp /// </remarks> PendingImplementation pending; - public TypeDefinition (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) + protected TypeDefinition (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) : base (parent, name, attrs, kind) { PartialContainer = this; @@ -688,6 +693,12 @@ namespace Mono.CSharp } } + bool ITypeDefinition.IsCyclicTypeForwarder { + get { + return false; + } + } + // // Returns true for secondary partial containers // @@ -971,7 +982,7 @@ namespace Mono.CSharp if (s == null) { s = EmptyExpressionStatement.Instance; } else if (!fi.IsSideEffectFree) { - has_complex_initializer |= true; + has_complex_initializer = true; } init [i] = s; @@ -987,6 +998,7 @@ namespace Mono.CSharp if (!has_complex_initializer && fi.IsDefaultInitializer) continue; + ec.AssignmentInfoOffset += fi.AssignmentOffset; ec.CurrentBlock.AddScopeStatement (new StatementExpression (init [i])); } @@ -1008,6 +1020,7 @@ namespace Mono.CSharp if (fi.IsDefaultInitializer && ec.Module.Compiler.Settings.Optimize) continue; + ec.AssignmentInfoOffset += fi.AssignmentOffset; ec.CurrentBlock.AddScopeStatement (new StatementExpression (s)); } } @@ -2303,11 +2316,20 @@ namespace Mono.CSharp /// </summary> public bool VerifyImplements (InterfaceMemberBase mb) { - var ifaces = spec.Interfaces; + var ifaces = PartialContainer.Interfaces; if (ifaces != null) { foreach (TypeSpec t in ifaces){ if (t == mb.InterfaceType) return true; + + var expanded_base = t.Interfaces; + if (expanded_base == null) + continue; + + foreach (var bt in expanded_base) { + if (bt == mb.InterfaceType) + return true; + } } } @@ -2364,8 +2386,6 @@ namespace Mono.CSharp // // Public function used to locate types. // - // Set 'ignore_cs0104' to true if you want to ignore cs0104 errors. - // // Returns: Type or null if they type can not be found. // public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc) @@ -2391,7 +2411,13 @@ namespace Mono.CSharp if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility)) e = new TypeExpression (t, Location.Null); else { + var errors = Compiler.Report.Errors; e = Parent.LookupNamespaceOrType (name, arity, mode, loc); + + // TODO: LookupNamespaceOrType does more than just lookup. The result + // cannot be cached or the error reporting won't happen + if (errors != Compiler.Report.Errors) + return e; } } @@ -2474,7 +2500,7 @@ namespace Mono.CSharp SecurityType declarative_security; - public ClassOrStruct (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) + protected ClassOrStruct (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) : base (parent, name, attrs, kind) { } @@ -2726,6 +2752,17 @@ namespace Mono.CSharp } } + public override void GetCompletionStartingWith (string prefix, List<string> results) + { + base.GetCompletionStartingWith (prefix, results); + + var bt = base_type; + while (bt != null) { + results.AddRange (MemberCache.GetCompletitionMembers (this, bt, prefix).Where (l => l.IsStatic).Select (l => l.Name)); + bt = bt.BaseType; + } + } + protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class) { var ifaces = base.ResolveBaseTypes (out base_class); @@ -3137,7 +3174,7 @@ namespace Mono.CSharp readonly Modifiers explicit_mod_flags; public MethodAttributes flags; - public InterfaceMemberBase (TypeDefinition parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs) + protected InterfaceMemberBase (TypeDefinition parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs) : base (parent, type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs) { IsInterface = parent.Kind == MemberKind.Interface; @@ -3255,7 +3292,7 @@ namespace Mono.CSharp } } - if (!IsInterface && base_member.IsAbstract && !overrides) { + if (!IsInterface && base_member.IsAbstract && !overrides && !IsStatic) { Report.SymbolRelatedToPreviousError (base_member); Report.Error (533, Location, "`{0}' hides inherited abstract member `{1}'", GetSignatureForError (), base_member.GetSignatureForError ()); |