|
|
|
|
@ -45,7 +45,7 @@ namespace Mono.CSharp
@@ -45,7 +45,7 @@ namespace Mono.CSharp
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This is the base class for structs and classes.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class TypeContainer : DeclSpace, ITypeDefinition, ITypesContainer |
|
|
|
|
public abstract class TypeContainer : MemberCore, ITypeDefinition, ITypesContainer |
|
|
|
|
{ |
|
|
|
|
//
|
|
|
|
|
// Different context is needed when resolving type container base
|
|
|
|
|
@ -180,6 +180,7 @@ namespace Mono.CSharp
@@ -180,6 +180,7 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
Dictionary<MethodSpec, Method> hoisted_base_call_proxies; |
|
|
|
|
|
|
|
|
|
protected Dictionary<string, MemberCore> defined_names; |
|
|
|
|
Dictionary<string, FullNamedExpression> Cache = new Dictionary<string, FullNamedExpression> (); |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
@ -211,7 +212,9 @@ namespace Mono.CSharp
@@ -211,7 +212,9 @@ namespace Mono.CSharp
|
|
|
|
|
bool type_defined; |
|
|
|
|
|
|
|
|
|
TypeContainer InTransit; |
|
|
|
|
public TypeContainer PartialContainer; |
|
|
|
|
|
|
|
|
|
public TypeBuilder TypeBuilder; |
|
|
|
|
GenericTypeParameterBuilder[] all_tp_builders; |
|
|
|
|
//
|
|
|
|
|
// All recursive type parameters put together sharing same
|
|
|
|
|
@ -219,6 +222,13 @@ namespace Mono.CSharp
@@ -219,6 +222,13 @@ namespace Mono.CSharp
|
|
|
|
|
//
|
|
|
|
|
TypeParameters all_type_parameters; |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// This is the namespace in which this typecontainer
|
|
|
|
|
// was declared. We use this to resolve names.
|
|
|
|
|
//
|
|
|
|
|
public NamespaceContainer NamespaceEntry; |
|
|
|
|
|
|
|
|
|
public readonly string Basename; |
|
|
|
|
public const string DefaultIndexerName = "Item"; |
|
|
|
|
|
|
|
|
|
private bool seen_normal_indexers = false; |
|
|
|
|
@ -235,21 +245,26 @@ namespace Mono.CSharp
@@ -235,21 +245,26 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
public int DynamicSitesCounter; |
|
|
|
|
|
|
|
|
|
static readonly string[] attribute_targets = new string[] { "type" }; |
|
|
|
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// The pending methods that need to be implemented
|
|
|
|
|
// (interfaces or abstract methods)
|
|
|
|
|
/// </remarks>
|
|
|
|
|
PendingImplementation pending; |
|
|
|
|
|
|
|
|
|
public TypeContainer (NamespaceContainer ns, DeclSpace parent, MemberName name, |
|
|
|
|
Attributes attrs, MemberKind kind) |
|
|
|
|
: base (ns, parent, name, attrs) |
|
|
|
|
public TypeContainer (NamespaceContainer ns, TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) |
|
|
|
|
: base (parent, name, attrs) |
|
|
|
|
{ |
|
|
|
|
if (parent != null && parent.NamespaceEntry != ns) |
|
|
|
|
throw new InternalErrorException ("A nested type should be in the same NamespaceEntry as its enclosing class"); |
|
|
|
|
|
|
|
|
|
this.Kind = kind; |
|
|
|
|
this.PartialContainer = this; |
|
|
|
|
this.Basename = name.Basename; |
|
|
|
|
this.NamespaceEntry = ns; |
|
|
|
|
|
|
|
|
|
defined_names = new Dictionary<string, MemberCore> (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<MemberCore> orderedAllMembers = new List<MemberCore> (); |
|
|
|
|
@ -270,7 +285,7 @@ namespace Mono.CSharp
@@ -270,7 +285,7 @@ namespace Mono.CSharp
|
|
|
|
|
public override TypeSpec CurrentType { |
|
|
|
|
get { |
|
|
|
|
if (current_type == null) { |
|
|
|
|
if (IsGeneric) { |
|
|
|
|
if (IsGenericOrParentIsGeneric) { |
|
|
|
|
//
|
|
|
|
|
// Switch to inflated version as it's used by all expressions
|
|
|
|
|
//
|
|
|
|
|
@ -337,12 +352,58 @@ namespace Mono.CSharp
@@ -337,12 +352,58 @@ namespace Mono.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public bool IsGenericOrParentIsGeneric { |
|
|
|
|
get { |
|
|
|
|
return all_type_parameters != null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// root_types contains all the types. All TopLevel types
|
|
|
|
|
// hence have a parent that points to `root_types', that is
|
|
|
|
|
// why there is a non-obvious test down here.
|
|
|
|
|
//
|
|
|
|
|
public bool IsTopLevel { |
|
|
|
|
get { |
|
|
|
|
return Parent != null && Parent.Parent == null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string ITypeDefinition.Namespace { |
|
|
|
|
get { |
|
|
|
|
return NamespaceEntry.NS.MemberName.GetSignatureForError (); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public TypeParameters TypeParametersAll { |
|
|
|
|
get { |
|
|
|
|
return all_type_parameters; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string[] ValidAttributeTargets { |
|
|
|
|
get { |
|
|
|
|
return attribute_targets; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if FULL_AST
|
|
|
|
|
public bool HasOptionalSemicolon { |
|
|
|
|
get; |
|
|
|
|
private set; |
|
|
|
|
} |
|
|
|
|
Location optionalSemicolon; |
|
|
|
|
public Location OptionalSemicolon { |
|
|
|
|
get { |
|
|
|
|
return optionalSemicolon; |
|
|
|
|
} |
|
|
|
|
set { |
|
|
|
|
optionalSemicolon = value; |
|
|
|
|
HasOptionalSemicolon = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public override void Accept (StructuralVisitor visitor) |
|
|
|
|
@ -367,7 +428,7 @@ namespace Mono.CSharp
@@ -367,7 +428,7 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
protected virtual void RemoveMemberType (TypeContainer ds) |
|
|
|
|
{ |
|
|
|
|
RemoveFromContainer (ds.Basename); |
|
|
|
|
defined_names.Remove (ds.Basename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AddConstant (Const constant) |
|
|
|
|
@ -381,12 +442,62 @@ namespace Mono.CSharp
@@ -381,12 +442,62 @@ namespace Mono.CSharp
|
|
|
|
|
constants.Add (constant); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Adds the member to defined_names table. It tests for duplications and enclosing name conflicts
|
|
|
|
|
//
|
|
|
|
|
protected virtual bool AddToContainer (MemberCore symbol, string name) |
|
|
|
|
{ |
|
|
|
|
MemberCore mc; |
|
|
|
|
if (!defined_names.TryGetValue (name, out mc)) { |
|
|
|
|
defined_names.Add (name, symbol); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (((mc.ModFlags | symbol.ModFlags) & Modifiers.COMPILER_GENERATED) != 0) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
if (symbol.EnableOverloadChecks (mc)) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
InterfaceMemberBase im = mc as InterfaceMemberBase; |
|
|
|
|
if (im != null && im.IsExplicitImpl) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
Report.SymbolRelatedToPreviousError (mc); |
|
|
|
|
if ((mc.ModFlags & Modifiers.PARTIAL) != 0 && (symbol is ClassOrStruct || symbol is Interface)) { |
|
|
|
|
Error_MissingPartialModifier (symbol); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (symbol is TypeParameter) { |
|
|
|
|
Report.Error (692, symbol.Location, |
|
|
|
|
"Duplicate type parameter `{0}'", symbol.GetSignatureForError ()); |
|
|
|
|
} else { |
|
|
|
|
Report.Error (102, symbol.Location, |
|
|
|
|
"The type `{0}' already contains a definition for `{1}'", |
|
|
|
|
GetSignatureForError (), name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public TypeContainer AddTypeContainer (TypeContainer tc) |
|
|
|
|
{ |
|
|
|
|
orderedAllMembers.Add (tc); |
|
|
|
|
if (!AddMemberType (tc)) |
|
|
|
|
return tc; |
|
|
|
|
|
|
|
|
|
var tparams = tc.MemberName.TypeParameters; |
|
|
|
|
if (tparams != null) { |
|
|
|
|
for (int i = 0; i < tparams.Count; ++i) { |
|
|
|
|
var tp = tparams[i]; |
|
|
|
|
if (tp.MemberName == null) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
tc.AddMember (tp, tp.Name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (types == null) |
|
|
|
|
types = new List<TypeContainer> (); |
|
|
|
|
|
|
|
|
|
@ -427,6 +538,26 @@ namespace Mono.CSharp
@@ -427,6 +538,26 @@ namespace Mono.CSharp
|
|
|
|
|
next_part.GetSignatureForError ()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var tc_names = tc.CurrentTypeParameters; |
|
|
|
|
if (tc_names != null) { |
|
|
|
|
for (int i = 0; i < tc_names.Count; ++i) { |
|
|
|
|
var tp = next_part.MemberName.TypeParameters[i]; |
|
|
|
|
if (tc_names[i].MemberName.Name != tp.MemberName.Name) { |
|
|
|
|
Report.SymbolRelatedToPreviousError (tc.Location, ""); |
|
|
|
|
Report.Error (264, next_part.Location, "Partial declarations of `{0}' must have the same type parameter names in the same order", |
|
|
|
|
next_part.GetSignatureForError ()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (tc_names[i].Variance != tp.Variance) { |
|
|
|
|
Report.SymbolRelatedToPreviousError (tc.Location, ""); |
|
|
|
|
Report.Error (1067, next_part.Location, "Partial declarations of `{0}' must have the same type parameter variance modifiers", |
|
|
|
|
next_part.GetSignatureForError ()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (tc.partial_parts == null) |
|
|
|
|
tc.partial_parts = new List<TypeContainer> (1); |
|
|
|
|
|
|
|
|
|
@ -692,7 +823,7 @@ namespace Mono.CSharp
@@ -692,7 +823,7 @@ namespace Mono.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected override TypeAttributes TypeAttr { |
|
|
|
|
protected virtual TypeAttributes TypeAttr { |
|
|
|
|
get { |
|
|
|
|
return ModifiersExtensions.TypeAttr (ModFlags, IsTopLevel); |
|
|
|
|
} |
|
|
|
|
@ -724,12 +855,6 @@ namespace Mono.CSharp
@@ -724,12 +855,6 @@ namespace Mono.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string ITypeDefinition.Namespace { |
|
|
|
|
get { |
|
|
|
|
return NamespaceEntry.NS.MemberName.GetSignatureForError (); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void RegisterFieldForInitialization (MemberCore field, FieldInitializer expression) |
|
|
|
|
{ |
|
|
|
|
if ((field.ModFlags & Modifiers.STATIC) != 0){ |
|
|
|
|
@ -898,11 +1023,9 @@ namespace Mono.CSharp
@@ -898,11 +1023,9 @@ namespace Mono.CSharp
|
|
|
|
|
return a.GetAttributeUsageAttribute (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void AddBasesForPart (DeclSpace part, List<FullNamedExpression> bases) |
|
|
|
|
public virtual void AddBasesForPart (TypeContainer part, List<FullNamedExpression> bases) |
|
|
|
|
{ |
|
|
|
|
// FIXME: get rid of partial_parts and store lists of bases of each part here
|
|
|
|
|
// assumed, not verified: 'part' is in 'partial_parts'
|
|
|
|
|
((TypeContainer) part).type_bases = bases; |
|
|
|
|
part.type_bases = bases; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -980,6 +1103,19 @@ namespace Mono.CSharp
@@ -980,6 +1103,19 @@ namespace Mono.CSharp
|
|
|
|
|
return ifaces; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Returns the MemberCore associated with a given name in the declaration
|
|
|
|
|
// space. It doesn't return method based symbols !!
|
|
|
|
|
//
|
|
|
|
|
// TODO: protected or private
|
|
|
|
|
//
|
|
|
|
|
public MemberCore GetDefinition (string name) |
|
|
|
|
{ |
|
|
|
|
MemberCore mc = null; |
|
|
|
|
defined_names.TryGetValue (name, out mc); |
|
|
|
|
return mc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TypeSpec[] GetNormalPartialBases () |
|
|
|
|
{ |
|
|
|
|
var ifaces = new List<TypeSpec> (0); |
|
|
|
|
@ -1018,6 +1154,16 @@ namespace Mono.CSharp
@@ -1018,6 +1154,16 @@ namespace Mono.CSharp
|
|
|
|
|
return ifaces.ToArray (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSignatureForDocumentation () |
|
|
|
|
{ |
|
|
|
|
return MemberName.GetName (true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSignatureForError () |
|
|
|
|
{ |
|
|
|
|
return MemberName.GetSignatureForError (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Checks that some operators come in pairs:
|
|
|
|
|
// == and !=
|
|
|
|
|
@ -1097,7 +1243,7 @@ namespace Mono.CSharp
@@ -1097,7 +1243,7 @@ namespace Mono.CSharp
|
|
|
|
|
int type_size = Kind == MemberKind.Struct && first_nonstatic_field == null ? 1 : 0; |
|
|
|
|
|
|
|
|
|
if (IsTopLevel) { |
|
|
|
|
TypeBuilder = Module.CreateBuilder (Name, TypeAttr, type_size); |
|
|
|
|
TypeBuilder = Module.CreateBuilder (MemberName.GetName (true), TypeAttr, type_size); |
|
|
|
|
} else { |
|
|
|
|
TypeBuilder = Parent.TypeBuilder.DefineNestedType (Basename, TypeAttr, null, type_size); |
|
|
|
|
} |
|
|
|
|
@ -1112,7 +1258,7 @@ namespace Mono.CSharp
@@ -1112,7 +1258,7 @@ namespace Mono.CSharp
|
|
|
|
|
if (!IsTopLevel) |
|
|
|
|
Parent.MemberCache.AddMember (spec); |
|
|
|
|
|
|
|
|
|
if (IsGeneric) { |
|
|
|
|
if (MemberName.TypeParameters != null || Parent.IsGenericOrParentIsGeneric) { |
|
|
|
|
var tparam_names = CreateTypeParameters (); |
|
|
|
|
|
|
|
|
|
all_tp_builders = TypeBuilder.DefineGenericParameters (tparam_names); |
|
|
|
|
@ -1204,7 +1350,6 @@ namespace Mono.CSharp
@@ -1204,7 +1350,6 @@ namespace Mono.CSharp
|
|
|
|
|
cloned_params.Types[0] = Module.PredefinedTypes.RuntimeArgumentHandle.Resolve (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GenericMethod generic_method; |
|
|
|
|
MemberName member_name; |
|
|
|
|
TypeArguments targs = null; |
|
|
|
|
if (method.IsGeneric) { |
|
|
|
|
@ -1218,22 +1363,19 @@ namespace Mono.CSharp
@@ -1218,22 +1363,19 @@ namespace Mono.CSharp
|
|
|
|
|
targs.Arguments = new TypeSpec[hoisted_tparams.Length]; |
|
|
|
|
for (int i = 0; i < hoisted_tparams.Length; ++i) { |
|
|
|
|
var tp = hoisted_tparams[i]; |
|
|
|
|
tparams.Add (new TypeParameter (tp, this, null, new MemberName (tp.Name, Location), null)); |
|
|
|
|
tparams.Add (new TypeParameter (tp, null, new MemberName (tp.Name, Location), null)); |
|
|
|
|
|
|
|
|
|
targs.Add (new SimpleName (tp.Name, Location)); |
|
|
|
|
targs.Arguments[i] = tp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
member_name = new MemberName (name, tparams, Location); |
|
|
|
|
generic_method = new GenericMethod (NamespaceEntry, this, member_name, |
|
|
|
|
new TypeExpression (method.ReturnType, Location), cloned_params); |
|
|
|
|
} else { |
|
|
|
|
member_name = new MemberName (name); |
|
|
|
|
generic_method = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Compiler generated proxy
|
|
|
|
|
proxy_method = new Method (this, generic_method, new TypeExpression (method.ReturnType, Location), |
|
|
|
|
proxy_method = new Method (this, new TypeExpression (method.ReturnType, Location), |
|
|
|
|
Modifiers.PRIVATE | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN, |
|
|
|
|
member_name, cloned_params, null); |
|
|
|
|
|
|
|
|
|
@ -1412,7 +1554,7 @@ namespace Mono.CSharp
@@ -1412,7 +1554,7 @@ namespace Mono.CSharp
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void DefineType () |
|
|
|
|
public void DefineType () |
|
|
|
|
{ |
|
|
|
|
if (error) |
|
|
|
|
return; |
|
|
|
|
@ -1441,32 +1583,6 @@ namespace Mono.CSharp
@@ -1441,32 +1583,6 @@ namespace Mono.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void SetParameterInfo (List<Constraints> constraints_list) |
|
|
|
|
{ |
|
|
|
|
base.SetParameterInfo (constraints_list); |
|
|
|
|
|
|
|
|
|
if (PartialContainer.CurrentTypeParameters == null || PartialContainer == this) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
var tc_names = PartialContainer.CurrentTypeParameters; |
|
|
|
|
for (int i = 0; i < tc_names.Count; ++i) { |
|
|
|
|
var tp = MemberName.TypeParameters[i]; |
|
|
|
|
if (tc_names[i].MemberName.Name != tp.MemberName.Name) { |
|
|
|
|
Report.SymbolRelatedToPreviousError (PartialContainer.Location, ""); |
|
|
|
|
Report.Error (264, Location, "Partial declarations of `{0}' must have the same type parameter names in the same order", |
|
|
|
|
GetSignatureForError ()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (tc_names[i].Variance != tp.Variance) { |
|
|
|
|
Report.SymbolRelatedToPreviousError (PartialContainer.Location, ""); |
|
|
|
|
Report.Error (1067, Location, "Partial declarations of `{0}' must have the same type parameter variance modifiers", |
|
|
|
|
GetSignatureForError ()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Replaces normal spec with predefined one when compiling corlib
|
|
|
|
|
// and this type container defines predefined type
|
|
|
|
|
@ -1667,7 +1783,7 @@ namespace Mono.CSharp
@@ -1667,7 +1783,7 @@ namespace Mono.CSharp
|
|
|
|
|
if (obsolete_attr != null && !IsObsolete) |
|
|
|
|
AttributeTester.Report_ObsoleteMessage (obsolete_attr, base_type.GetSignatureForError (), base_type_expr.Location, Report); |
|
|
|
|
|
|
|
|
|
if (IsGeneric && base_type.IsAttribute) { |
|
|
|
|
if (IsGenericOrParentIsGeneric && base_type.IsAttribute) { |
|
|
|
|
Report.Error (698, base_type_expr.Location, |
|
|
|
|
"A generic type cannot derive from `{0}' because it is an attribute class", |
|
|
|
|
base_type.GetSignatureForError ()); |
|
|
|
|
@ -2078,6 +2194,13 @@ namespace Mono.CSharp
@@ -2078,6 +2194,13 @@ namespace Mono.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void Error_MissingPartialModifier (MemberCore type) |
|
|
|
|
{ |
|
|
|
|
Report.Error (260, type.Location, |
|
|
|
|
"Missing partial modifier on declaration of type `{0}'. Another partial declaration of this type exists", |
|
|
|
|
type.GetSignatureForError ()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void CloseType () |
|
|
|
|
{ |
|
|
|
|
if ((caching_flags & Flags.CloseTypeCreated) != 0) |
|
|
|
|
@ -2279,6 +2402,11 @@ namespace Mono.CSharp
@@ -2279,6 +2402,11 @@ namespace Mono.CSharp
|
|
|
|
|
return Module.DeclaringAssembly == assembly; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual bool IsUnmanagedType () |
|
|
|
|
{ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void LoadMembers (TypeSpec declaringType, bool onlyTypes, ref MemberCache cache) |
|
|
|
|
{ |
|
|
|
|
throw new NotSupportedException ("Not supported for compiled definition " + GetSignatureForError ()); |
|
|
|
|
@ -2401,8 +2529,7 @@ namespace Mono.CSharp
@@ -2401,8 +2529,7 @@ namespace Mono.CSharp
|
|
|
|
|
{ |
|
|
|
|
SecurityType declarative_security; |
|
|
|
|
|
|
|
|
|
public ClassOrStruct (NamespaceContainer ns, DeclSpace parent, |
|
|
|
|
MemberName name, Attributes attrs, MemberKind kind) |
|
|
|
|
public ClassOrStruct (NamespaceContainer ns, TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind) |
|
|
|
|
: base (ns, parent, name, attrs, kind) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
@ -2527,8 +2654,7 @@ namespace Mono.CSharp
@@ -2527,8 +2654,7 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
public override ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity) |
|
|
|
|
{ |
|
|
|
|
DeclSpace top_level = Parent; |
|
|
|
|
if (top_level != null) { |
|
|
|
|
if (Parent != null) { |
|
|
|
|
var methods = NamespaceEntry.NS.LookupExtensionMethod (this, extensionType, name, arity); |
|
|
|
|
if (methods != null) { |
|
|
|
|
return new ExtensionMethodCandidates (methods, NamespaceEntry, NamespaceEntry.NS) { |
|
|
|
|
@ -2566,8 +2692,7 @@ namespace Mono.CSharp
@@ -2566,8 +2692,7 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
public const TypeAttributes StaticClassAttribute = TypeAttributes.Abstract | TypeAttributes.Sealed; |
|
|
|
|
|
|
|
|
|
public Class (NamespaceContainer ns, DeclSpace parent, MemberName name, Modifiers mod, |
|
|
|
|
Attributes attrs) |
|
|
|
|
public Class (NamespaceContainer ns, TypeContainer parent, MemberName name, Modifiers mod, Attributes attrs) |
|
|
|
|
: base (ns, parent, name, attrs, MemberKind.Class) |
|
|
|
|
{ |
|
|
|
|
var accmods = (Parent == null || Parent.Parent == null) ? Modifiers.INTERNAL : Modifiers.PRIVATE; |
|
|
|
|
@ -2580,9 +2705,10 @@ namespace Mono.CSharp
@@ -2580,9 +2705,10 @@ namespace Mono.CSharp
|
|
|
|
|
visitor.Visit (this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void AddBasesForPart (DeclSpace part, List<FullNamedExpression> bases) |
|
|
|
|
public override void AddBasesForPart (TypeContainer part, List<FullNamedExpression> bases) |
|
|
|
|
{ |
|
|
|
|
if (part.Name == "System.Object") |
|
|
|
|
var pmn = part.MemberName; |
|
|
|
|
if (pmn.Name == "Object" && pmn.Left != null && pmn.Left.Name == "System" && pmn.TypeParameters == null) |
|
|
|
|
Report.Error (537, part.Location, |
|
|
|
|
"The class System.Object cannot have a base class or implement an interface."); |
|
|
|
|
base.AddBasesForPart (part, bases); |
|
|
|
|
@ -2800,8 +2926,7 @@ namespace Mono.CSharp
@@ -2800,8 +2926,7 @@ namespace Mono.CSharp
|
|
|
|
|
Modifiers.UNSAFE | |
|
|
|
|
Modifiers.PRIVATE; |
|
|
|
|
|
|
|
|
|
public Struct (NamespaceContainer ns, DeclSpace parent, MemberName name, |
|
|
|
|
Modifiers mod, Attributes attrs) |
|
|
|
|
public Struct (NamespaceContainer ns, TypeContainer parent, MemberName name, Modifiers mod, Attributes attrs) |
|
|
|
|
: base (ns, parent, name, attrs, MemberKind.Struct) |
|
|
|
|
{ |
|
|
|
|
var accmods = parent.Parent == null ? Modifiers.INTERNAL : Modifiers.PRIVATE; |
|
|
|
|
@ -2912,7 +3037,7 @@ namespace Mono.CSharp
@@ -2912,7 +3037,7 @@ namespace Mono.CSharp
|
|
|
|
|
if (requires_delayed_unmanagedtype_check) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
if (Parent != null && Parent.IsGeneric) { |
|
|
|
|
if (Parent != null && Parent.IsGenericOrParentIsGeneric) { |
|
|
|
|
has_unmanaged_check_done = true; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
@ -2991,8 +3116,7 @@ namespace Mono.CSharp
@@ -2991,8 +3116,7 @@ namespace Mono.CSharp
|
|
|
|
|
Modifiers.UNSAFE | |
|
|
|
|
Modifiers.PRIVATE; |
|
|
|
|
|
|
|
|
|
public Interface (NamespaceContainer ns, DeclSpace parent, MemberName name, Modifiers mod, |
|
|
|
|
Attributes attrs) |
|
|
|
|
public Interface (NamespaceContainer ns, TypeContainer parent, MemberName name, Modifiers mod, Attributes attrs) |
|
|
|
|
: base (ns, parent, name, attrs, MemberKind.Interface) |
|
|
|
|
{ |
|
|
|
|
var accmods = parent.Parent == null ? Modifiers.INTERNAL : Modifiers.PRIVATE; |
|
|
|
|
@ -3122,11 +3246,8 @@ namespace Mono.CSharp
@@ -3122,11 +3246,8 @@ namespace Mono.CSharp
|
|
|
|
|
readonly Modifiers explicit_mod_flags; |
|
|
|
|
public MethodAttributes flags; |
|
|
|
|
|
|
|
|
|
public InterfaceMemberBase (DeclSpace parent, GenericMethod generic, |
|
|
|
|
FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, |
|
|
|
|
MemberName name, Attributes attrs) |
|
|
|
|
: base (parent, generic, type, mod, allowed_mod, Modifiers.PRIVATE, |
|
|
|
|
name, attrs) |
|
|
|
|
public InterfaceMemberBase (TypeContainer parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs) |
|
|
|
|
: base (parent, type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs) |
|
|
|
|
{ |
|
|
|
|
IsInterface = parent.PartialContainer.Kind == MemberKind.Interface; |
|
|
|
|
IsExplicitImpl = (MemberName.ExplicitInterface != null); |
|
|
|
|
@ -3523,18 +3644,6 @@ namespace Mono.CSharp
@@ -3523,18 +3644,6 @@ namespace Mono.CSharp
|
|
|
|
|
return Parent.GetSignatureForDocumentation () + "." + ShortName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected override bool VerifyClsCompliance () |
|
|
|
|
{ |
|
|
|
|
if (!base.VerifyClsCompliance ()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (GenericMethod != null) |
|
|
|
|
GenericMethod.VerifyClsCompliance (); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool IsUsed |
|
|
|
|
{ |
|
|
|
|
get { return IsExplicitImpl || base.IsUsed; } |
|
|
|
|
@ -3547,26 +3656,11 @@ namespace Mono.CSharp
@@ -3547,26 +3656,11 @@ namespace Mono.CSharp
|
|
|
|
|
protected FullNamedExpression type_expr; |
|
|
|
|
protected TypeSpec member_type; |
|
|
|
|
|
|
|
|
|
public readonly DeclSpace ds; |
|
|
|
|
public readonly GenericMethod GenericMethod; |
|
|
|
|
|
|
|
|
|
public FullNamedExpression TypeName { |
|
|
|
|
get { |
|
|
|
|
return type_expr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected MemberBase (DeclSpace parent, GenericMethod generic, |
|
|
|
|
FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, Modifiers def_mod, |
|
|
|
|
MemberName name, Attributes attrs) |
|
|
|
|
protected MemberBase (TypeContainer parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, Modifiers def_mod, MemberName name, Attributes attrs) |
|
|
|
|
: base (parent, name, attrs) |
|
|
|
|
{ |
|
|
|
|
this.ds = generic != null ? generic : (DeclSpace) parent; |
|
|
|
|
this.type_expr = type; |
|
|
|
|
ModFlags = ModifiersExtensions.Check (allowed_mod, mod, def_mod, Location, Report); |
|
|
|
|
GenericMethod = generic; |
|
|
|
|
if (GenericMethod != null) |
|
|
|
|
GenericMethod.ModFlags = ModFlags; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
@ -3679,7 +3773,7 @@ namespace Mono.CSharp
@@ -3679,7 +3773,7 @@ namespace Mono.CSharp
|
|
|
|
|
|
|
|
|
|
public override string GetSignatureForDocumentation () |
|
|
|
|
{ |
|
|
|
|
return Parent.Name + "." + Name; |
|
|
|
|
return Parent.GetSignatureForDocumentation () + "." + MemberName.Basename; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual bool ResolveMemberType () |
|
|
|
|
|