Skip to content

Commit

Permalink
Rename EntityType -> SymbolKind
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Jun 12, 2013
1 parent 5e9edc0 commit 7c388ba
Show file tree
Hide file tree
Showing 88 changed files with 465 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public override void VisitInvocationExpression(InvocationExpression invocationEx
#region IsInactiveConditional helper methods
bool IsInactiveConditionalMethod(IParameterizedMember member)
{
if (member.EntityType != EntityType.Method || member.ReturnType.Kind != TypeKind.Void)
if (member.SymbolKind != SymbolKind.Method || member.ReturnType.Kind != TypeKind.Void)
return false;
while (member.IsOverride) {
member = (IParameterizedMember)InheritanceHelper.GetBaseMember(member);
Expand Down Expand Up @@ -461,21 +461,21 @@ void HandleConstructorOrDestructor(AstNode constructorDeclaration)

bool TryGetMemberColor(IMember member, out TColor color)
{
switch (member.EntityType) {
case EntityType.Field:
switch (member.SymbolKind) {
case SymbolKind.Field:
color = fieldAccessColor;
return true;
case EntityType.Property:
case SymbolKind.Property:
color = propertyAccessColor;
return true;
case EntityType.Event:
case SymbolKind.Event:
color = eventAccessColor;
return true;
case EntityType.Method:
case SymbolKind.Method:
color = methodCallColor;
return true;
case EntityType.Constructor:
case EntityType.Destructor:
case SymbolKind.Constructor:
case SymbolKind.Destructor:
return TryGetTypeHighlighting (member.DeclaringType.Kind, out color);
default:
color = default (TColor);
Expand Down
28 changes: 14 additions & 14 deletions ICSharpCode.NRefactory.CSharp/Ast/DocumentationReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@ public class DocumentationReference : AstNode
public static readonly Role<AstType> DeclaringTypeRole = new Role<AstType>("DeclaringType", AstType.Null);
public static readonly Role<AstType> ConversionOperatorReturnTypeRole = new Role<AstType>("ConversionOperatorReturnType", AstType.Null);

EntityType entityType;
SymbolKind symbolKind;
OperatorType operatorType;
bool hasParameterList;

/// <summary>
/// Gets/Sets the entity type.
/// Possible values are:
/// <c>EntityType.Operator</c> for operators,
/// <c>EntityType.Indexer</c> for indexers,
/// <c>EntityType.TypeDefinition</c> for references to primitive types,
/// and <c>EntityType.None</c> for everything else.
/// <c>SymbolKind.Operator</c> for operators,
/// <c>SymbolKind.Indexer</c> for indexers,
/// <c>SymbolKind.TypeDefinition</c> for references to primitive types,
/// and <c>SymbolKind.None</c> for everything else.
/// </summary>
public EntityType EntityType {
get { return entityType; }
public SymbolKind SymbolKind {
get { return symbolKind; }
set {
ThrowIfFrozen();
entityType = value;
symbolKind = value;
}
}

/// <summary>
/// Gets/Sets the operator type.
/// This property is only used when EntityType==Operator.
/// This property is only used when SymbolKind==Operator.
/// </summary>
public OperatorType OperatorType {
get { return operatorType; }
Expand Down Expand Up @@ -86,7 +86,7 @@ public AstType DeclaringType {

/// <summary>
/// Gets/sets the member name.
/// This property is only used when EntityType==None.
/// This property is only used when SymbolKind==None.
/// </summary>
public string MemberName {
get { return GetChildByRole(Roles.Identifier).Name; }
Expand All @@ -95,7 +95,7 @@ public string MemberName {

/// <summary>
/// Gets/Sets the return type of conversion operators.
/// This property is only used when EntityType==Operator and OperatorType is explicit or implicit.
/// This property is only used when SymbolKind==Operator and OperatorType is explicit or implicit.
/// </summary>
public AstType ConversionOperatorReturnType {
get { return GetChildByRole(ConversionOperatorReturnTypeRole); }
Expand All @@ -113,16 +113,16 @@ public AstNodeCollection<ParameterDeclaration> Parameters {
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
DocumentationReference o = other as DocumentationReference;
if (!(o != null && this.EntityType == o.EntityType && this.HasParameterList == o.HasParameterList))
if (!(o != null && this.SymbolKind == o.SymbolKind && this.HasParameterList == o.HasParameterList))
return false;
if (this.EntityType == EntityType.Operator) {
if (this.SymbolKind == SymbolKind.Operator) {
if (this.OperatorType != o.OperatorType)
return false;
if (this.OperatorType == OperatorType.Implicit || this.OperatorType == OperatorType.Explicit) {
if (!this.ConversionOperatorReturnType.DoMatch(o.ConversionOperatorReturnType, match))
return false;
}
} else if (this.EntityType == EntityType.None) {
} else if (this.SymbolKind == SymbolKind.None) {
if (!MatchString(this.MemberName, o.MemberName))
return false;
if (!this.TypeArguments.DoMatch(o.TypeArguments, match))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public override NodeType NodeType {
get { return NodeType.TypeDeclaration; }
}

public override EntityType EntityType {
get { return EntityType.TypeDefinition; }
public override SymbolKind SymbolKind {
get { return SymbolKind.TypeDefinition; }
}

public CSharpTokenNode DelegateToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public override NodeType NodeType {
get { return NodeType.TypeDeclaration; }
}

public override EntityType EntityType {
get { return EntityType.TypeDefinition; }
public override SymbolKind SymbolKind {
get { return SymbolKind.TypeDefinition; }
}

ClassType classType;
Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/Accessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public override NodeType NodeType {
get { return NodeType.Unknown; }
}

public override EntityType EntityType {
get { return EntityType.Method; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Method; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class ConstructorDeclaration : EntityDeclaration
{
public static readonly Role<ConstructorInitializer> InitializerRole = new Role<ConstructorInitializer>("Initializer", ConstructorInitializer.Null);

public override EntityType EntityType {
get { return EntityType.Constructor; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Constructor; }
}

public CSharpTokenNode LParToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public CSharpTokenNode TildeToken {
get { return GetChildByRole (TildeRole); }
}

public override EntityType EntityType {
get { return EntityType.Destructor; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Destructor; }
}

public CSharpTokenNode LParToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override NodeType NodeType {
get { return NodeType.Member; }
}

public abstract NRefactory.TypeSystem.EntityType EntityType { get; }
public abstract NRefactory.TypeSystem.SymbolKind SymbolKind { get; }

public AstNodeCollection<AttributeSection> Attributes {
get { return base.GetChildrenByRole (AttributeRole); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class EnumMemberDeclaration : EntityDeclaration
{
public static readonly Role<Expression> InitializerRole = new Role<Expression>("Initializer", Expression.Null);

public override EntityType EntityType {
get { return EntityType.Field; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Field; }
}

public CSharpTokenNode AssignToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class EventDeclaration : EntityDeclaration
{
public static readonly TokenRole EventKeywordRole = new TokenRole ("event");

public override EntityType EntityType {
get { return EntityType.Event; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Event; }
}

public CSharpTokenNode EventToken {
Expand Down Expand Up @@ -94,8 +94,8 @@ public class CustomEventDeclaration : EntityDeclaration
public static readonly Role<Accessor> AddAccessorRole = new Role<Accessor>("AddAccessor", Accessor.Null);
public static readonly Role<Accessor> RemoveAccessorRole = new Role<Accessor>("RemoveAccessor", Accessor.Null);

public override EntityType EntityType {
get { return EntityType.Event; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Event; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace ICSharpCode.NRefactory.CSharp
{
public class FieldDeclaration : EntityDeclaration
{
public override EntityType EntityType {
get { return EntityType.Field; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Field; }
}

public AstNodeCollection<VariableInitializer> Variables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class FixedFieldDeclaration : EntityDeclaration
public static readonly TokenRole FixedKeywordRole = new TokenRole ("fixed");
public static readonly Role<FixedVariableInitializer> VariableRole = new Role<FixedVariableInitializer> ("FixedVariable");

public override EntityType EntityType {
get { return EntityType.Field; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Field; }
}

public CSharpTokenNode FixedToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class IndexerDeclaration : EntityDeclaration
public static readonly Role<Accessor> GetterRole = PropertyDeclaration.GetterRole;
public static readonly Role<Accessor> SetterRole = PropertyDeclaration.SetterRole;

public override EntityType EntityType {
get { return EntityType.Indexer; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Indexer; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace ICSharpCode.NRefactory.CSharp
{
public class MethodDeclaration : EntityDeclaration
{
public override EntityType EntityType {
get { return EntityType.Method; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Method; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public class OperatorDeclaration : EntityDeclaration
public static readonly TokenRole ExplicitRole = new TokenRole ("explicit");
public static readonly TokenRole ImplicitRole = new TokenRole ("implicit");

public override EntityType EntityType {
get { return EntityType.Operator; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Operator; }
}

OperatorType operatorType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class PropertyDeclaration : EntityDeclaration
public static readonly Role<Accessor> GetterRole = new Role<Accessor>("Getter", Accessor.Null);
public static readonly Role<Accessor> SetterRole = new Role<Accessor>("Setter", Accessor.Null);

public override EntityType EntityType {
get { return EntityType.Property; }
public override SymbolKind SymbolKind {
get { return SymbolKind.Property; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ IEnumerable<ICompletionData> HandleObjectInitializer(SyntaxTree unit, AstNode n)
bool isProtectedAllowed = ctx.CurrentTypeDefinition != null && initializerType.GetDefinition() != null ?
ctx.CurrentTypeDefinition.IsDerivedFrom(initializerType.GetDefinition()) :
false;
foreach (var m in initializerType.GetMembers (m => m.EntityType == EntityType.Field)) {
foreach (var m in initializerType.GetMembers (m => m.SymbolKind == SymbolKind.Field)) {
var f = m as IField;
if (f != null && (f.IsReadOnly || f.IsConst))
continue;
if (lookup.IsAccessible (m, isProtectedAllowed))
contextList.AddMember(m);
}
foreach (IProperty m in initializerType.GetMembers (m => m.EntityType == EntityType.Property)) {
foreach (IProperty m in initializerType.GetMembers (m => m.SymbolKind == SymbolKind.Property)) {
if (m.CanSet && lookup.IsAccessible (m.Setter, isProtectedAllowed))
contextList.AddMember(m);
}
Expand Down Expand Up @@ -1506,7 +1506,7 @@ void AddTypesAndNamespaces(CompletionDataWrapper wrapper, CSharpResolver state,
if (member is IMethod && ((IMethod)member).FullName == "System.Object.Finalize") {
continue;
}
if (member.EntityType == EntityType.Operator) {
if (member.SymbolKind == SymbolKind.Operator) {
continue;
}
if (member.IsExplicitInterfaceImplementation) {
Expand Down Expand Up @@ -2159,7 +2159,7 @@ public string GetPreviousMemberReferenceExpression(int tokenIndex)

bool MatchDelegate(IType delegateType, IMethod method)
{
if (method.EntityType != EntityType.Method)
if (method.SymbolKind != SymbolKind.Method)
return false;
var delegateMethod = delegateType.GetDelegateInvokeMethod();
if (delegateMethod == null || delegateMethod.Parameters.Count != method.Parameters.Count) {
Expand Down Expand Up @@ -2608,7 +2608,7 @@ out trr
result.AddMember(member);
}*/
foreach (var member in lookup.GetAccessibleMembers (resolveResult)) {
if (member.EntityType == EntityType.Indexer || member.EntityType == EntityType.Operator || member.EntityType == EntityType.Constructor || member.EntityType == EntityType.Destructor) {
if (member.SymbolKind == SymbolKind.Indexer || member.SymbolKind == SymbolKind.Operator || member.SymbolKind == SymbolKind.Constructor || member.SymbolKind == SymbolKind.Destructor) {
continue;
}
if (resolvedNode is BaseReferenceExpression && member.IsAbstract) {
Expand Down Expand Up @@ -2639,7 +2639,7 @@ out trr
if (member is IMethod && ((IMethod)member).FullName == "System.Object.Finalize") {
continue;
}
if (member.EntityType == EntityType.Operator) {
if (member.SymbolKind == SymbolKind.Operator) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// CompletionDataWrapper.cs
//
// Author:
Expand Down Expand Up @@ -172,14 +172,14 @@ public ICompletionData AddMember (IMember member)
List<ICompletionData> existingData;
data.TryGetValue (memberKey, out existingData);
if (existingData != null) {
if (member.EntityType == EntityType.Field || member.EntityType == EntityType.Property || member.EntityType == EntityType.Event)
if (member.SymbolKind == SymbolKind.Field || member.SymbolKind == SymbolKind.Property || member.SymbolKind == SymbolKind.Event)
return null;
var a = member as IEntity;
foreach (var d in existingData) {
if (!(d is IEntityCompletionData))
continue;
var b = ((IEntityCompletionData)d).Entity;
if (a == null || b == null || a.EntityType == b.EntityType) {
if (a == null || b == null || a.SymbolKind == b.SymbolKind) {
d.AddOverload (newData);
return d;
}
Expand Down
Loading

0 comments on commit 7c388ba

Please sign in to comment.