提交 bc3e7265 编写于 作者: I Ivan Basov

code review feedback

上级 da6d0c35
...@@ -48,7 +48,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext ...@@ -48,7 +48,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
public readonly bool IsCrefContext; public readonly bool IsCrefContext;
public readonly bool IsCatchFilterContext; public readonly bool IsCatchFilterContext;
public readonly bool IsDestructorTypeContext; public readonly bool IsDestructorTypeContext;
public readonly bool IsAfterFirstDotOfDotDot;
private CSharpSyntaxContext( private CSharpSyntaxContext(
Workspace workspace, Workspace workspace,
...@@ -100,7 +99,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext ...@@ -100,7 +99,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
bool isDestructorTypeContext, bool isDestructorTypeContext,
bool isPossibleTupleContext, bool isPossibleTupleContext,
bool isPatternContext, bool isPatternContext,
bool isAfterFirstDotOfDotDot,
CancellationToken cancellationToken) CancellationToken cancellationToken)
: base(workspace, semanticModel, position, leftToken, targetToken, : base(workspace, semanticModel, position, leftToken, targetToken,
isTypeContext, isNamespaceContext, isNamespaceDeclarationNameContext, isTypeContext, isNamespaceContext, isNamespaceDeclarationNameContext,
...@@ -140,7 +138,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext ...@@ -140,7 +138,6 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
this.IsCrefContext = isCrefContext; this.IsCrefContext = isCrefContext;
this.IsCatchFilterContext = isCatchFilterContext; this.IsCatchFilterContext = isCatchFilterContext;
this.IsDestructorTypeContext = isDestructorTypeContext; this.IsDestructorTypeContext = isDestructorTypeContext;
this.IsAfterFirstDotOfDotDot = isAfterFirstDotOfDotDot;
} }
public static CSharpSyntaxContext CreateContext(Workspace workspace, SemanticModel semanticModel, int position, CancellationToken cancellationToken) public static CSharpSyntaxContext CreateContext(Workspace workspace, SemanticModel semanticModel, int position, CancellationToken cancellationToken)
...@@ -228,7 +225,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema ...@@ -228,7 +225,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema
isInImportsDirective: IsLeftSideOfUsingAliasDirective(leftToken, cancellationToken), isInImportsDirective: IsLeftSideOfUsingAliasDirective(leftToken, cancellationToken),
isLabelContext: syntaxTree.IsLabelContext(position, cancellationToken), isLabelContext: syntaxTree.IsLabelContext(position, cancellationToken),
isTypeArgumentOfConstraintContext: syntaxTree.IsTypeArgumentOfConstraintClause(position, cancellationToken), isTypeArgumentOfConstraintContext: syntaxTree.IsTypeArgumentOfConstraintClause(position, cancellationToken),
isRightOfDotOrArrowOrColonColon: syntaxTree.IsRightOfDotOrArrowOrColonColon(position, cancellationToken), isRightOfDotOrArrowOrColonColon: isAfterFirstDotOfDotDot || syntaxTree.IsRightOfDotOrArrowOrColonColon(position, cancellationToken),
isIsOrAsOrSwitchExpressionContext: syntaxTree.IsIsOrAsOrSwitchExpressionContext(semanticModel, position, leftToken, cancellationToken), isIsOrAsOrSwitchExpressionContext: syntaxTree.IsIsOrAsOrSwitchExpressionContext(semanticModel, position, leftToken, cancellationToken),
isObjectCreationTypeContext: syntaxTree.IsObjectCreationTypeContext(position, leftToken, cancellationToken), isObjectCreationTypeContext: syntaxTree.IsObjectCreationTypeContext(position, leftToken, cancellationToken),
isDefiniteCastTypeContext: syntaxTree.IsDefiniteCastTypeContext(position, leftToken, cancellationToken), isDefiniteCastTypeContext: syntaxTree.IsDefiniteCastTypeContext(position, leftToken, cancellationToken),
...@@ -251,7 +248,6 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema ...@@ -251,7 +248,6 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema
isDestructorTypeContext: isDestructorTypeContext, isDestructorTypeContext: isDestructorTypeContext,
isPossibleTupleContext: syntaxTree.IsPossibleTupleContext(leftToken, position), isPossibleTupleContext: syntaxTree.IsPossibleTupleContext(leftToken, position),
isPatternContext: syntaxTree.IsPatternContext(leftToken, position), isPatternContext: syntaxTree.IsPatternContext(leftToken, position),
isAfterFirstDotOfDotDot: isAfterFirstDotOfDotDot,
cancellationToken: cancellationToken); cancellationToken: cancellationToken);
} }
......
...@@ -66,7 +66,6 @@ internal class CSharpRecommendationService : AbstractRecommendationService ...@@ -66,7 +66,6 @@ internal class CSharpRecommendationService : AbstractRecommendationService
} }
else if (context.IsAnyExpressionContext || else if (context.IsAnyExpressionContext ||
context.IsStatementContext || context.IsStatementContext ||
context.IsAfterFirstDotOfDotDot ||
context.SyntaxTree.IsDefiniteCastTypeContext(context.Position, context.LeftToken, cancellationToken)) context.SyntaxTree.IsDefiniteCastTypeContext(context.Position, context.LeftToken, cancellationToken))
{ {
// GitHub #717: With automatic brace completion active, typing '(i' produces "(i)", which gets parsed as // GitHub #717: With automatic brace completion active, typing '(i' produces "(i)", which gets parsed as
...@@ -110,6 +109,10 @@ internal class CSharpRecommendationService : AbstractRecommendationService ...@@ -110,6 +109,10 @@ internal class CSharpRecommendationService : AbstractRecommendationService
{ {
return GetSymbolsOffOfExpression(context, ((MemberAccessExpressionSyntax)node).Expression, cancellationToken); return GetSymbolsOffOfExpression(context, ((MemberAccessExpressionSyntax)node).Expression, cancellationToken);
} }
else if (node.Kind() == SyntaxKind.RangeExpression)
{
return GetSymbolsOffOfExpression(context, ((RangeExpressionSyntax)node).LeftOperand, cancellationToken);
}
else if (node.Kind() == SyntaxKind.PointerMemberAccessExpression) else if (node.Kind() == SyntaxKind.PointerMemberAccessExpression)
{ {
return GetSymbolsOffOfDereferencedExpression(context, ((MemberAccessExpressionSyntax)node).Expression, cancellationToken); return GetSymbolsOffOfDereferencedExpression(context, ((MemberAccessExpressionSyntax)node).Expression, cancellationToken);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册