Permalink
Browse files

Marks CSharpKind and VBKind extension methods as Obsolete and adds eq…

…uivalent extension methods Kind for both languages.

Marks CSharpKind and VBKind instance methods on language specific syntax nodes Obsolete as well.
 (changeset 1389494)
  • Loading branch information...
tmat committed Dec 19, 2014
1 parent 4fffe94 commit 8c146441b4ecedbf7648e890d33f946f9b206e01
Showing 356 changed files with 3,624 additions and 3,554 deletions.
@@ -411,7 +411,7 @@ private static string GetMethodName(BaseMethodDeclarationSyntax baseMethodDeclar
case SyntaxKind.OperatorDeclaration:
return OperatorFacts.OperatorNameFromDeclaration((OperatorDeclarationSyntax)baseMethodDeclarationSyntax);
case SyntaxKind.ConversionOperatorDeclaration:
return ((ConversionOperatorDeclarationSyntax)baseMethodDeclarationSyntax).ImplicitOrExplicitKeyword.CSharpKind() == SyntaxKind.ImplicitKeyword
return ((ConversionOperatorDeclarationSyntax)baseMethodDeclarationSyntax).ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword
? WellKnownMemberNames.ImplicitConversionName
: WellKnownMemberNames.ExplicitConversionName;
case SyntaxKind.MethodDeclaration:
@@ -54,7 +54,7 @@ private BoundExpression BindAnonymousObjectCreation(AnonymousObjectCreationExpre
// check the name to be unique
string fieldName = null;
if (nameToken.CSharpKind() == SyntaxKind.IdentifierToken)
if (nameToken.Kind() == SyntaxKind.IdentifierToken)
{
fieldName = nameToken.ValueText;
if (uniqueFieldNames.Contains(fieldName))
@@ -79,7 +79,7 @@ private BoundExpression BindAnonymousObjectCreation(AnonymousObjectCreationExpre
TypeSymbol fieldType = GetAnonymousTypeFieldType(boundExpressions[i], fieldInitializer, diagnostics, ref hasError);
// build anonymous type field descriptor
fieldSyntaxNodes[i] = (nameToken.CSharpKind() == SyntaxKind.IdentifierToken) ? (CSharpSyntaxNode)nameToken.Parent : fieldInitializer;
fieldSyntaxNodes[i] = (nameToken.Kind() == SyntaxKind.IdentifierToken) ? (CSharpSyntaxNode)nameToken.Parent : fieldInitializer;
fields[i] = new AnonymousTypeField(fieldName == null ? '$' + i.ToString() : fieldName, fieldSyntaxNodes[i].Location, fieldType);
// NOTE: ERR_InvalidAnonymousTypeMemberDeclarator (CS0746) would be generated by parser if needed
@@ -229,7 +229,7 @@ private ImmutableArray<Symbol> BindOperatorMemberCref(OperatorMemberCrefSyntax s
// NOTE: Prefer binary to unary, unless there is exactly one parameter.
// CONSIDER: we're following dev11 by never using a binary operator name if there's
// exactly one parameter, but doing so would allow us to match single-parameter constructors.
SyntaxKind operatorTokenKind = syntax.OperatorToken.CSharpKind();
SyntaxKind operatorTokenKind = syntax.OperatorToken.Kind();
string memberName = parameterListSyntax != null && parameterListSyntax.Parameters.Count == 1
? null
: OperatorFacts.BinaryOperatorNameFromSyntaxKindIfAny(operatorTokenKind);
@@ -264,7 +264,7 @@ private ImmutableArray<Symbol> BindConversionOperatorMemberCref(ConversionOperat
{
const int arity = 0;
string memberName = syntax.ImplicitOrExplicitKeyword.CSharpKind() == SyntaxKind.ImplicitKeyword
string memberName = syntax.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword
? WellKnownMemberNames.ImplicitConversionName
: WellKnownMemberNames.ExplicitConversionName;
@@ -869,7 +869,7 @@ private ImmutableArray<ParameterSymbol> BindCrefParameters(BaseCrefParameterList
foreach (CrefParameterSyntax parameter in parameterListSyntax.Parameters)
{
RefKind refKind = parameter.RefOrOutKeyword.CSharpKind().GetRefKind();
RefKind refKind = parameter.RefOrOutKeyword.Kind().GetRefKind();
TypeSymbol type = BindCrefParameterOrReturnType(parameter.Type, (MemberCrefSyntax)parameterListSyntax.Parent, diagnostics);
@@ -1692,7 +1692,7 @@ private void BindArgumentsAndNames(BracketedArgumentListSyntax argumentListOpt,
ArgumentSyntax argumentSyntax,
bool allowArglist)
{
RefKind refKind = argumentSyntax.RefOrOutKeyword.CSharpKind().GetRefKind();
RefKind refKind = argumentSyntax.RefOrOutKeyword.Kind().GetRefKind();
hadError |= BindArgumentAndName(
result,
@@ -4400,7 +4400,7 @@ private bool IsUsingAliasInScope(string name)
// No member accesses on void
if ((object)leftType != null && leftType.SpecialType == SpecialType.System_Void)
{
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.CSharpKind()), leftType);
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.Kind()), leftType);
diagnostics.Add(new CSDiagnostic(diagnosticInfo, operatorToken.GetLocation()));
return BadExpression(node, boundLeft);
}
@@ -4410,7 +4410,7 @@ private bool IsUsingAliasInScope(string name)
Debug.Assert((object)leftType == null);
var msgId = ((UnboundLambda)boundLeft).MessageID;
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.CSharpKind()), msgId.Localize());
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.Kind()), msgId.Localize());
diagnostics.Add(new CSDiagnostic(diagnosticInfo, node.Location));
return BadExpression(node, boundLeft);
}
@@ -6250,7 +6250,7 @@ private BoundConditionalAccess GenerateBadConditionalAccessNodeError(Conditional
var operatorToken = node.OperatorToken;
// TODO: need a special ERR for this.
// conditional access is not really a binary operator.
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.CSharpKind()), access.Display);
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.Kind()), access.Display);
diagnostics.Add(new CSDiagnostic(diagnosticInfo, operatorToken.GetLocation()));
access = BadExpression(access.Syntax, access);
@@ -6279,7 +6279,7 @@ private CSharpSyntaxNode GetConditionalReceiverSyntax(ConditionalAccessExpressio
Debug.Assert(node.Expression != null);
var receiver = node.Expression;
while (receiver.CSharpKind() == SyntaxKind.ParenthesizedExpression)
while (receiver.IsKind(SyntaxKind.ParenthesizedExpression))
{
receiver = ((ParenthesizedExpressionSyntax)receiver).Expression;
Debug.Assert(receiver != null);
@@ -6334,7 +6334,7 @@ private BoundExpression BindConditionalAccessReceiver(ConditionalAccessExpressio
if (receiver.Kind == BoundKind.UnboundLambda)
{
var msgId = ((UnboundLambda)receiver).MessageID;
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.CSharpKind()), msgId.Localize());
DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.Kind()), msgId.Localize());
diagnostics.Add(new CSDiagnostic(diagnosticInfo, node.Location));
return BadExpression(receiverSyntax, receiver);
}
@@ -850,7 +850,7 @@ private Location GetLocationForOverloadResolutionDiagnostic(CSharpSyntaxNode nod
{
if (node != expression)
{
switch (expression.CSharpKind())
switch (expression.Kind)
{
case SyntaxKind.QualifiedName:
return ((QualifiedNameSyntax)expression).Right.GetLocation();
@@ -1058,7 +1058,7 @@ private bool TryBindNameofOperator(InvocationExpressionSyntax node, DiagnosticBa
{
result = null;
if (node.Expression.Kind != SyntaxKind.IdentifierName ||
!((IdentifierNameSyntax)node.Expression).Identifier.IsContextualKind(SyntaxKind.NameOfKeyword) ||
((IdentifierNameSyntax)node.Expression).Identifier.ContextualKind() != SyntaxKind.NameOfKeyword ||
node.ArgumentList.Arguments.Count != 1)
{
return false;
@@ -53,15 +53,15 @@ internal partial class Binder
hasSignature = true;
var simple = (SimpleLambdaExpressionSyntax)syntax;
namesBuilder.Add(simple.Parameter.Identifier.ValueText);
isAsync = (simple.AsyncKeyword.CSharpKind() == SyntaxKind.AsyncKeyword);
isAsync = (simple.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword);
break;
case SyntaxKind.ParenthesizedLambdaExpression:
// (T x, U y) => ...
// (x, y) => ...
hasSignature = true;
var paren = (ParenthesizedLambdaExpressionSyntax)syntax;
parameterSyntaxList = paren.ParameterList.Parameters;
isAsync = (paren.AsyncKeyword.CSharpKind() == SyntaxKind.AsyncKeyword);
isAsync = (paren.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword);
break;
case SyntaxKind.AnonymousMethodExpression:
// delegate (int x) { }
@@ -72,7 +72,7 @@ internal partial class Binder
{
parameterSyntaxList = anon.ParameterList.Parameters;
}
isAsync = (anon.AsyncKeyword.CSharpKind() == SyntaxKind.AsyncKeyword);
isAsync = (anon.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword);
break;
}
@@ -113,19 +113,19 @@ internal partial class Binder
type = BindType(typeSyntax, diagnostics);
foreach (var modifier in p.Modifiers)
{
if (modifier.CSharpKind() == SyntaxKind.RefKeyword)
if (modifier.Kind() == SyntaxKind.RefKeyword)
{
refKind = RefKind.Ref;
allValue = false;
break;
}
else if (modifier.CSharpKind() == SyntaxKind.OutKeyword)
else if (modifier.Kind() == SyntaxKind.OutKeyword)
{
refKind = RefKind.Out;
allValue = false;
break;
}
else if (modifier.CSharpKind() == SyntaxKind.ParamsKeyword)
else if (modifier.Kind() == SyntaxKind.ParamsKeyword)
{
// This was a parse error in the native compiler;
// it is a semantic analysis error in Roslyn. See comments to
@@ -3017,7 +3017,7 @@ internal static ConstantValue GetAsOperatorConstantResult(TypeSymbol operandType
private BoundExpression GenerateNullCoalescingBadBinaryOpsError(BinaryExpressionSyntax node, BoundExpression leftOperand, BoundExpression rightOperand, Conversion leftConversion, DiagnosticBag diagnostics)
{
Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, SyntaxFacts.GetText(node.OperatorToken.CSharpKind()), leftOperand.Display, rightOperand.Display);
Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, SyntaxFacts.GetText(node.OperatorToken.Kind()), leftOperand.Display, rightOperand.Display);
return new BoundNullCoalescingOperator(node, leftOperand, rightOperand,
leftConversion, CreateErrorType(), hasErrors: true);
}
@@ -252,7 +252,7 @@ private NamespaceOrTypeSymbol GetContainingNamespaceOrType(Symbol symbol)
internal Symbol BindNamespaceAliasSymbol(IdentifierNameSyntax node, DiagnosticBag diagnostics)
{
if (node.Identifier.CSharpKind() == SyntaxKind.GlobalKeyword)
if (node.Identifier.Kind() == SyntaxKind.GlobalKeyword)
{
return this.Compilation.GlobalNamespaceAlias;
}
@@ -391,7 +391,7 @@ internal Symbol BindNamespaceOrTypeOrAliasSymbol(ExpressionSyntax syntax, Diagno
private Symbol BindPredefinedTypeSymbol(PredefinedTypeSyntax node, DiagnosticBag diagnostics)
{
return GetSpecialType(node.Keyword.CSharpKind().GetSpecialType(), diagnostics, node);
return GetSpecialType(node.Keyword.Kind().GetSpecialType(), diagnostics, node);
}
/// <summary>
@@ -24,7 +24,7 @@ override protected ImmutableArray<LocalSymbol> BuildLocals()
SourceLocalSymbol local = null;
var declarationOpt = syntax.Declaration;
if ((declarationOpt != null) && (declarationOpt.Identifier.CSharpKind() != SyntaxKind.None))
if ((declarationOpt != null) && (declarationOpt.Identifier.Kind() != SyntaxKind.None))
{
local = SourceLocalSymbol.MakeLocal(this.ContainingMemberOrLambda, this, declarationOpt.Type, declarationOpt.Identifier, LocalDeclarationKind.CatchVariable);
}
@@ -290,7 +290,7 @@ public static Imports FromGlobalUsings(CSharpCompilation compilation)
}
}
if (aliasSyntax.Identifier.CSharpContextualKind() == SyntaxKind.GlobalKeyword)
if (aliasSyntax.Identifier.ContextualKind() == SyntaxKind.GlobalKeyword)
{
diagnostics.Add(ErrorCode.ERR_GlobalExternAlias, aliasSyntax.Identifier.GetLocation());
}
@@ -51,7 +51,7 @@ internal SwitchBinder(Binder next, SwitchStatementSyntax switchSyntax)
var map = new Dictionary<object, List<SourceLabelSymbol>>(labels.Length, new SwitchConstantValueHelper.SwitchLabelsComparer());
foreach (SourceLabelSymbol label in labels)
{
SyntaxKind labelKind = label.IdentifierNodeOrToken.CSharpKind();
SyntaxKind labelKind = label.IdentifierNodeOrToken.Kind();
if (labelKind == SyntaxKind.CaseSwitchLabel ||
labelKind == SyntaxKind.DefaultSwitchLabel)
@@ -586,7 +586,7 @@ internal BoundStatement BindGotoCaseOrDefault(GotoStatementSyntax node, Diagnost
if (!hasErrors)
{
// No matching case label/default label found
var labelName = SyntaxFacts.GetText(node.CaseOrDefaultKeyword.CSharpKind());
var labelName = SyntaxFacts.GetText(node.CaseOrDefaultKeyword.Kind());
if (node.Kind == SyntaxKind.GotoCaseStatement)
{
labelName += " " + node.Expression.ToString();
@@ -15,7 +15,7 @@ internal sealed class WhileBinder : LoopBinder
public WhileBinder(Binder enclosing, StatementSyntax syntax)
: base(enclosing)
{
Debug.Assert(syntax != null && (syntax.CSharpKind() == SyntaxKind.WhileStatement || syntax.CSharpKind() == SyntaxKind.DoStatement));
Debug.Assert(syntax != null && (syntax.IsKind(SyntaxKind.WhileStatement) || syntax.IsKind(SyntaxKind.DoStatement)));
this.syntax = syntax;
}
Oops, something went wrong.

0 comments on commit 8c14644

Please sign in to comment.