|
|
@ -223,7 +223,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
|
|
|
|
|
|
|
|
ConvertAttributes(td.Attributes, typeDeclaration.Attributes); |
|
|
|
ConvertAttributes(td.Attributes, typeDeclaration.Attributes); |
|
|
|
|
|
|
|
|
|
|
|
ConvertTypeParameters(td.TypeParameters, typeDeclaration.TypeParameters, typeDeclaration.Constraints, EntityType.TypeDefinition); |
|
|
|
ConvertTypeParameters(td.TypeParameters, typeDeclaration.TypeParameters, typeDeclaration.Constraints, SymbolKind.TypeDefinition); |
|
|
|
|
|
|
|
|
|
|
|
foreach (AstType baseType in typeDeclaration.BaseTypes) { |
|
|
|
foreach (AstType baseType in typeDeclaration.BaseTypes) { |
|
|
|
td.BaseTypes.Add(ConvertTypeReference(baseType, NameLookupMode.BaseTypeReference)); |
|
|
|
td.BaseTypes.Add(ConvertTypeReference(baseType, NameLookupMode.BaseTypeReference)); |
|
|
@ -249,7 +249,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
ApplyModifiers(td, delegateDeclaration.Modifiers); |
|
|
|
ApplyModifiers(td, delegateDeclaration.Modifiers); |
|
|
|
td.IsSealed = true; // delegates are implicitly sealed
|
|
|
|
td.IsSealed = true; // delegates are implicitly sealed
|
|
|
|
|
|
|
|
|
|
|
|
ConvertTypeParameters(td.TypeParameters, delegateDeclaration.TypeParameters, delegateDeclaration.Constraints, EntityType.TypeDefinition); |
|
|
|
ConvertTypeParameters(td.TypeParameters, delegateDeclaration.TypeParameters, delegateDeclaration.Constraints, SymbolKind.TypeDefinition); |
|
|
|
|
|
|
|
|
|
|
|
ITypeReference returnType = ConvertTypeReference(delegateDeclaration.ReturnType); |
|
|
|
ITypeReference returnType = ConvertTypeReference(delegateDeclaration.ReturnType); |
|
|
|
List<IUnresolvedParameter> parameters = new List<IUnresolvedParameter>(); |
|
|
|
List<IUnresolvedParameter> parameters = new List<IUnresolvedParameter>(); |
|
|
@ -332,7 +332,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
delegateType.Members.Add(endInvoke); |
|
|
|
delegateType.Members.Add(endInvoke); |
|
|
|
|
|
|
|
|
|
|
|
DefaultUnresolvedMethod ctor = new DefaultUnresolvedMethod(delegateType, ".ctor"); |
|
|
|
DefaultUnresolvedMethod ctor = new DefaultUnresolvedMethod(delegateType, ".ctor"); |
|
|
|
ctor.EntityType = EntityType.Constructor; |
|
|
|
ctor.SymbolKind = SymbolKind.Constructor; |
|
|
|
ctor.Accessibility = Accessibility.Public; |
|
|
|
ctor.Accessibility = Accessibility.Public; |
|
|
|
ctor.IsSynthetic = true; |
|
|
|
ctor.IsSynthetic = true; |
|
|
|
ctor.Parameters.Add(delegateObjectParameter); |
|
|
|
ctor.Parameters.Add(delegateObjectParameter); |
|
|
@ -392,7 +392,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ITypeReference[] typeArgs = new ITypeReference[currentTypeDefinition.TypeParameters.Count]; |
|
|
|
ITypeReference[] typeArgs = new ITypeReference[currentTypeDefinition.TypeParameters.Count]; |
|
|
|
for (int i = 0; i < typeArgs.Length; i++) { |
|
|
|
for (int i = 0; i < typeArgs.Length; i++) { |
|
|
|
typeArgs[i] = TypeParameterReference.Create(EntityType.TypeDefinition, i); |
|
|
|
typeArgs[i] = TypeParameterReference.Create(SymbolKind.TypeDefinition, i); |
|
|
|
} |
|
|
|
} |
|
|
|
field.ReturnType = interningProvider.Intern(new ParameterizedTypeReference(currentTypeDefinition, typeArgs)); |
|
|
|
field.ReturnType = interningProvider.Intern(new ParameterizedTypeReference(currentTypeDefinition, typeArgs)); |
|
|
|
} |
|
|
|
} |
|
|
@ -435,7 +435,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
m.TypeParameters.Add(tp); |
|
|
|
m.TypeParameters.Add(tp); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ConvertTypeParameters(m.TypeParameters, methodDeclaration.TypeParameters, methodDeclaration.Constraints, EntityType.Method); |
|
|
|
ConvertTypeParameters(m.TypeParameters, methodDeclaration.TypeParameters, methodDeclaration.Constraints, SymbolKind.Method); |
|
|
|
} |
|
|
|
} |
|
|
|
m.ReturnType = ConvertTypeReference(methodDeclaration.ReturnType); |
|
|
|
m.ReturnType = ConvertTypeReference(methodDeclaration.ReturnType); |
|
|
|
ConvertAttributes(m.Attributes, methodDeclaration.Attributes.Where(s => s.AttributeTarget != "return")); |
|
|
|
ConvertAttributes(m.Attributes, methodDeclaration.Attributes.Where(s => s.AttributeTarget != "return")); |
|
|
@ -457,7 +457,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
m.IsExplicitInterfaceImplementation = true; |
|
|
|
m.IsExplicitInterfaceImplementation = true; |
|
|
|
m.ExplicitInterfaceImplementations.Add( |
|
|
|
m.ExplicitInterfaceImplementations.Add( |
|
|
|
interningProvider.Intern(new DefaultMemberReference( |
|
|
|
interningProvider.Intern(new DefaultMemberReference( |
|
|
|
m.EntityType, |
|
|
|
m.SymbolKind, |
|
|
|
ConvertTypeReference(methodDeclaration.PrivateImplementationType), |
|
|
|
ConvertTypeReference(methodDeclaration.PrivateImplementationType), |
|
|
|
m.Name, m.TypeParameters.Count, GetParameterTypes(m.Parameters)))); |
|
|
|
m.Name, m.TypeParameters.Count, GetParameterTypes(m.Parameters)))); |
|
|
|
} |
|
|
|
} |
|
|
@ -488,7 +488,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ConvertTypeParameters(IList<IUnresolvedTypeParameter> output, AstNodeCollection<TypeParameterDeclaration> typeParameters, |
|
|
|
void ConvertTypeParameters(IList<IUnresolvedTypeParameter> output, AstNodeCollection<TypeParameterDeclaration> typeParameters, |
|
|
|
AstNodeCollection<Constraint> constraints, EntityType ownerType) |
|
|
|
AstNodeCollection<Constraint> constraints, SymbolKind ownerType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// output might be non-empty when type parameters were copied from an outer class
|
|
|
|
// output might be non-empty when type parameters were copied from an outer class
|
|
|
|
int index = output.Count; |
|
|
|
int index = output.Count; |
|
|
@ -518,7 +518,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
var lookupMode = (ownerType == EntityType.TypeDefinition) ? NameLookupMode.BaseTypeReference : NameLookupMode.Type; |
|
|
|
var lookupMode = (ownerType == SymbolKind.TypeDefinition) ? NameLookupMode.BaseTypeReference : NameLookupMode.Type; |
|
|
|
tp.Constraints.Add(ConvertTypeReference(type, lookupMode)); |
|
|
|
tp.Constraints.Add(ConvertTypeReference(type, lookupMode)); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -535,7 +535,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
public override IUnresolvedEntity VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration) |
|
|
|
public override IUnresolvedEntity VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DefaultUnresolvedMethod m = new DefaultUnresolvedMethod(currentTypeDefinition, operatorDeclaration.Name); |
|
|
|
DefaultUnresolvedMethod m = new DefaultUnresolvedMethod(currentTypeDefinition, operatorDeclaration.Name); |
|
|
|
m.EntityType = EntityType.Operator; |
|
|
|
m.SymbolKind = SymbolKind.Operator; |
|
|
|
m.Region = MakeRegion(operatorDeclaration); |
|
|
|
m.Region = MakeRegion(operatorDeclaration); |
|
|
|
m.BodyRegion = MakeRegion(operatorDeclaration.Body); |
|
|
|
m.BodyRegion = MakeRegion(operatorDeclaration.Body); |
|
|
|
AddXmlDocumentation(m, operatorDeclaration); |
|
|
|
AddXmlDocumentation(m, operatorDeclaration); |
|
|
@ -561,7 +561,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
Modifiers modifiers = constructorDeclaration.Modifiers; |
|
|
|
Modifiers modifiers = constructorDeclaration.Modifiers; |
|
|
|
bool isStatic = (modifiers & Modifiers.Static) != 0; |
|
|
|
bool isStatic = (modifiers & Modifiers.Static) != 0; |
|
|
|
DefaultUnresolvedMethod ctor = new DefaultUnresolvedMethod(currentTypeDefinition, isStatic ? ".cctor" : ".ctor"); |
|
|
|
DefaultUnresolvedMethod ctor = new DefaultUnresolvedMethod(currentTypeDefinition, isStatic ? ".cctor" : ".ctor"); |
|
|
|
ctor.EntityType = EntityType.Constructor; |
|
|
|
ctor.SymbolKind = SymbolKind.Constructor; |
|
|
|
ctor.Region = MakeRegion(constructorDeclaration); |
|
|
|
ctor.Region = MakeRegion(constructorDeclaration); |
|
|
|
if (!constructorDeclaration.Initializer.IsNull) { |
|
|
|
if (!constructorDeclaration.Initializer.IsNull) { |
|
|
|
ctor.BodyRegion = MakeRegion(constructorDeclaration.Initializer.StartLocation, constructorDeclaration.EndLocation); |
|
|
|
ctor.BodyRegion = MakeRegion(constructorDeclaration.Initializer.StartLocation, constructorDeclaration.EndLocation); |
|
|
@ -590,7 +590,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
public override IUnresolvedEntity VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) |
|
|
|
public override IUnresolvedEntity VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DefaultUnresolvedMethod dtor = new DefaultUnresolvedMethod(currentTypeDefinition, "Finalize"); |
|
|
|
DefaultUnresolvedMethod dtor = new DefaultUnresolvedMethod(currentTypeDefinition, "Finalize"); |
|
|
|
dtor.EntityType = EntityType.Destructor; |
|
|
|
dtor.SymbolKind = SymbolKind.Destructor; |
|
|
|
dtor.Region = MakeRegion(destructorDeclaration); |
|
|
|
dtor.Region = MakeRegion(destructorDeclaration); |
|
|
|
dtor.BodyRegion = MakeRegion(destructorDeclaration.Body); |
|
|
|
dtor.BodyRegion = MakeRegion(destructorDeclaration.Body); |
|
|
|
dtor.Accessibility = Accessibility.Protected; |
|
|
|
dtor.Accessibility = Accessibility.Protected; |
|
|
@ -621,7 +621,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
p.Accessibility = Accessibility.None; |
|
|
|
p.Accessibility = Accessibility.None; |
|
|
|
p.IsExplicitInterfaceImplementation = true; |
|
|
|
p.IsExplicitInterfaceImplementation = true; |
|
|
|
p.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
p.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
p.EntityType, ConvertTypeReference(propertyDeclaration.PrivateImplementationType), p.Name))); |
|
|
|
p.SymbolKind, ConvertTypeReference(propertyDeclaration.PrivateImplementationType), p.Name))); |
|
|
|
} |
|
|
|
} |
|
|
|
bool isExtern = propertyDeclaration.HasModifier(Modifiers.Extern); |
|
|
|
bool isExtern = propertyDeclaration.HasModifier(Modifiers.Extern); |
|
|
|
p.Getter = ConvertAccessor(propertyDeclaration.Getter, p, "get_", isExtern); |
|
|
|
p.Getter = ConvertAccessor(propertyDeclaration.Getter, p, "get_", isExtern); |
|
|
@ -634,7 +634,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
public override IUnresolvedEntity VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) |
|
|
|
public override IUnresolvedEntity VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(currentTypeDefinition, "Item"); |
|
|
|
DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(currentTypeDefinition, "Item"); |
|
|
|
p.EntityType = EntityType.Indexer; |
|
|
|
p.SymbolKind = SymbolKind.Indexer; |
|
|
|
p.Region = MakeRegion(indexerDeclaration); |
|
|
|
p.Region = MakeRegion(indexerDeclaration); |
|
|
|
p.BodyRegion = MakeBraceRegion(indexerDeclaration); |
|
|
|
p.BodyRegion = MakeBraceRegion(indexerDeclaration); |
|
|
|
ApplyModifiers(p, indexerDeclaration.Modifiers); |
|
|
|
ApplyModifiers(p, indexerDeclaration.Modifiers); |
|
|
@ -648,7 +648,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
p.Accessibility = Accessibility.None; |
|
|
|
p.Accessibility = Accessibility.None; |
|
|
|
p.IsExplicitInterfaceImplementation = true; |
|
|
|
p.IsExplicitInterfaceImplementation = true; |
|
|
|
p.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
p.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
p.EntityType, indexerDeclaration.PrivateImplementationType.ToTypeReference(), p.Name, 0, GetParameterTypes(p.Parameters)))); |
|
|
|
p.SymbolKind, indexerDeclaration.PrivateImplementationType.ToTypeReference(), p.Name, 0, GetParameterTypes(p.Parameters)))); |
|
|
|
} |
|
|
|
} |
|
|
|
bool isExtern = indexerDeclaration.HasModifier(Modifiers.Extern); |
|
|
|
bool isExtern = indexerDeclaration.HasModifier(Modifiers.Extern); |
|
|
|
p.Getter = ConvertAccessor(indexerDeclaration.Getter, p, "get_", isExtern); |
|
|
|
p.Getter = ConvertAccessor(indexerDeclaration.Getter, p, "get_", isExtern); |
|
|
@ -664,7 +664,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
if (accessor.IsNull) |
|
|
|
if (accessor.IsNull) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
var a = new DefaultUnresolvedMethod(currentTypeDefinition, prefix + p.Name); |
|
|
|
var a = new DefaultUnresolvedMethod(currentTypeDefinition, prefix + p.Name); |
|
|
|
a.EntityType = EntityType.Accessor; |
|
|
|
a.SymbolKind = SymbolKind.Accessor; |
|
|
|
a.AccessorOwner = p; |
|
|
|
a.AccessorOwner = p; |
|
|
|
a.Accessibility = GetAccessibility(accessor.Modifiers) ?? p.Accessibility; |
|
|
|
a.Accessibility = GetAccessibility(accessor.Modifiers) ?? p.Accessibility; |
|
|
|
a.IsAbstract = p.IsAbstract; |
|
|
|
a.IsAbstract = p.IsAbstract; |
|
|
@ -680,7 +680,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
// a) there's no body in the code
|
|
|
|
// a) there's no body in the code
|
|
|
|
// b) the member is either abstract or extern
|
|
|
|
// b) the member is either abstract or extern
|
|
|
|
a.HasBody = !(accessor.Body.IsNull && (p.IsAbstract || memberIsExtern)); |
|
|
|
a.HasBody = !(accessor.Body.IsNull && (p.IsAbstract || memberIsExtern)); |
|
|
|
if (p.EntityType == EntityType.Indexer) { |
|
|
|
if (p.SymbolKind == SymbolKind.Indexer) { |
|
|
|
foreach (var indexerParam in ((IUnresolvedProperty)p).Parameters) |
|
|
|
foreach (var indexerParam in ((IUnresolvedProperty)p).Parameters) |
|
|
|
a.Parameters.Add(indexerParam); |
|
|
|
a.Parameters.Add(indexerParam); |
|
|
|
} |
|
|
|
} |
|
|
@ -705,7 +705,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
a.IsExplicitInterfaceImplementation = true; |
|
|
|
a.IsExplicitInterfaceImplementation = true; |
|
|
|
Debug.Assert(p.ExplicitInterfaceImplementations.Count == 1); |
|
|
|
Debug.Assert(p.ExplicitInterfaceImplementations.Count == 1); |
|
|
|
a.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
a.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
EntityType.Accessor, |
|
|
|
SymbolKind.Accessor, |
|
|
|
p.ExplicitInterfaceImplementations[0].DeclaringTypeReference, |
|
|
|
p.ExplicitInterfaceImplementations[0].DeclaringTypeReference, |
|
|
|
a.Name, 0, GetParameterTypes(a.Parameters) |
|
|
|
a.Name, 0, GetParameterTypes(a.Parameters) |
|
|
|
))); |
|
|
|
))); |
|
|
@ -757,7 +757,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
DefaultUnresolvedMethod CreateDefaultEventAccessor(IUnresolvedEvent ev, string name, IUnresolvedParameter valueParameter) |
|
|
|
DefaultUnresolvedMethod CreateDefaultEventAccessor(IUnresolvedEvent ev, string name, IUnresolvedParameter valueParameter) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var a = new DefaultUnresolvedMethod(currentTypeDefinition, name); |
|
|
|
var a = new DefaultUnresolvedMethod(currentTypeDefinition, name); |
|
|
|
a.EntityType = EntityType.Accessor; |
|
|
|
a.SymbolKind = SymbolKind.Accessor; |
|
|
|
a.AccessorOwner = ev; |
|
|
|
a.AccessorOwner = ev; |
|
|
|
a.Region = ev.BodyRegion; |
|
|
|
a.Region = ev.BodyRegion; |
|
|
|
a.BodyRegion = ev.BodyRegion; |
|
|
|
a.BodyRegion = ev.BodyRegion; |
|
|
@ -788,7 +788,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem |
|
|
|
e.Accessibility = Accessibility.None; |
|
|
|
e.Accessibility = Accessibility.None; |
|
|
|
e.IsExplicitInterfaceImplementation = true; |
|
|
|
e.IsExplicitInterfaceImplementation = true; |
|
|
|
e.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
e.ExplicitInterfaceImplementations.Add(interningProvider.Intern(new DefaultMemberReference( |
|
|
|
e.EntityType, eventDeclaration.PrivateImplementationType.ToTypeReference(), e.Name))); |
|
|
|
e.SymbolKind, eventDeclaration.PrivateImplementationType.ToTypeReference(), e.Name))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// custom events can't be extern; the non-custom event syntax must be used for extern events
|
|
|
|
// custom events can't be extern; the non-custom event syntax must be used for extern events
|
|
|
|