\n \n Add an assembly reference to '{0}'\n Ajouter une référence d'assembly à '{0}'\n \n \n \n Add 'new' keyword\n Ajouter le mot clé 'new'\n \n \n \n Add a project reference to '{0}'\n Ajouter une référence de projet à '{0}'\n \n \n \n Cannot determine the symbol under the caret\n Impossible de déterminer le symbole sous le point d'insertion\n \n \n \n Cannot navigate to the requested location\n Impossible d'accéder à l'emplacement demandé\n \n \n \n Exceptions:\n Exceptions :\n \n \n \n F# Disposable Types\n Types F# pouvant être supprimés\n \n \n \n F# Functions / Methods\n Fonctions / méthodes F#\n \n \n \n F# Mutable Variables / Reference Cells\n Variables mutables / Cellules de référence F#\n \n \n \n F# Printf Format\n Format Printf F#\n \n \n \n F# Properties\n Propriétés F#\n \n \n \n Generic parameters:\n Paramètres génériques :\n \n \n \n Implement interface\n Implémenter l'interface\n \n \n \n Implement interface without type annotation\n Implémenter l'interface sans annotation de type\n \n \n \n Locating the symbol under the caret...\n Localisation du symbole sous le point d'insertion...\n \n \n \n Name can be simplified.\n Le nom peut être simplifié.\n \n \n \n Navigate to symbol failed: {0}\n Échec de l'accès au symbole : {0}\n \n \n \n Navigating to symbol...\n Accès au symbole...\n \n \n \n Prefix '{0}' with underscore\n Faire précéder '{0}' d'un trait de soulignement\n \n \n \n Remove unused open declarations\n Supprimer les déclarations open inutilisées\n \n \n \n Rename '{0}' to '__'\n Renommer '{0}' en '__'\n \n \n \n Rename '{0}' to '_'\n Renommer '{0}' en '_'\n \n \n \n Simplify name\n Simplifier le nom\n \n \n \n The value is unused\n La valeur est inutilisée\n \n \n \n Open declaration can be removed.\n La déclaration open peut être supprimée.\n \n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":205,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56491,"string":"56,491"},"pr_title":{"kind":"string","value":"Make method extensions"},"pr_description":{"kind":"string","value":"No need for these to be instance methods on ABstractSyntaxFacts"},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T20:59:25Z","string":"2021-09-17T20:59:25Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:21Z","string":"2021-09-18T00:30:21Z"},"previous_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"pr_commit":{"kind":"string","value":"b7d780dba0b1fbe63215bb4ec7c253a5a469d7b6"},"query":{"kind":"string","value":"Make method extensions. No need for these to be instance methods on ABstractSyntaxFacts"},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/xlf/CSharpWorkspaceExtensionsResources.ja.xlf"},"before_content":{"kind":"string","value":"\n\n \n
\n \n Remove this value when another is added.\n 別の値が追加されたら、この値を削除します。\n https://github.com/Microsoft/msbuild/issues/1661\n \n
\n \n Remove this value when another is added.\n 別の値が追加されたら、この値を削除します。\n https://github.com/Microsoft/msbuild/issues/1661\n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":206,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56491,"string":"56,491"},"pr_title":{"kind":"string","value":"Make method extensions"},"pr_description":{"kind":"string","value":"No need for these to be instance methods on ABstractSyntaxFacts"},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T20:59:25Z","string":"2021-09-17T20:59:25Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:21Z","string":"2021-09-18T00:30:21Z"},"previous_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"pr_commit":{"kind":"string","value":"b7d780dba0b1fbe63215bb4ec7c253a5a469d7b6"},"query":{"kind":"string","value":"Make method extensions. No need for these to be instance methods on ABstractSyntaxFacts"},"filepath":{"kind":"string","value":"./src/VisualStudio/IntegrationTest/IntegrationService/Microsoft.VisualStudio.IntegrationTest.IntegrationService.csproj"},"before_content":{"kind":"string","value":"\n\n\n \n Library\n Microsoft.VisualStudio.IntegrationTest.IntegrationService\n net472\n false\n \n \n \n \n \n"},"after_content":{"kind":"string","value":"\n\n\n \n Library\n Microsoft.VisualStudio.IntegrationTest.IntegrationService\n net472\n false\n \n \n \n \n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":207,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.LanguageServices;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\nusing Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;\nusing Microsoft.CodeAnalysis.CSharp.Shared.Extensions;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.CSharp.LanguageServices\n{\n internal class CSharpSyntaxFacts : AbstractSyntaxFacts, ISyntaxFacts\n {\n internal static readonly CSharpSyntaxFacts Instance = new();\n\n protected CSharpSyntaxFacts()\n {\n }\n\n public bool IsCaseSensitive => true;\n\n public StringComparer StringComparer { get; } = StringComparer.Ordinal;\n\n public SyntaxTrivia ElasticMarker\n => SyntaxFactory.ElasticMarker;\n\n public SyntaxTrivia ElasticCarriageReturnLineFeed\n => SyntaxFactory.ElasticCarriageReturnLineFeed;\n\n public override ISyntaxKinds SyntaxKinds { get; } = CSharpSyntaxKinds.Instance;\n\n public bool SupportsIndexingInitializer(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp6;\n\n public bool SupportsThrowExpression(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp7;\n\n public bool SupportsLocalFunctionDeclaration(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp7;\n\n public bool SupportsRecord(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp9;\n\n public bool SupportsRecordStruct(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion.IsCSharp10OrAbove();\n\n public SyntaxToken ParseToken(string text)\n => SyntaxFactory.ParseToken(text);\n\n public SyntaxTriviaList ParseLeadingTrivia(string text)\n => SyntaxFactory.ParseLeadingTrivia(text);\n\n public string EscapeIdentifier(string identifier)\n {\n var nullIndex = identifier.IndexOf('\\0');\n if (nullIndex >= 0)\n {\n identifier = identifier.Substring(0, nullIndex);\n }\n\n var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None;\n return needsEscaping ? \"@\" + identifier : identifier;\n }\n\n public bool IsVerbatimIdentifier(SyntaxToken token)\n => token.IsVerbatimIdentifier();\n\n public bool IsOperator(SyntaxToken token)\n {\n var kind = token.Kind();\n\n return\n (SyntaxFacts.IsAnyUnaryExpression(kind) &&\n (token.Parent is PrefixUnaryExpressionSyntax || token.Parent is PostfixUnaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) ||\n (SyntaxFacts.IsBinaryExpression(kind) && (token.Parent is BinaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) ||\n (SyntaxFacts.IsAssignmentExpressionOperatorToken(kind) && token.Parent is AssignmentExpressionSyntax);\n }\n\n public bool IsReservedKeyword(SyntaxToken token)\n => SyntaxFacts.IsReservedKeyword(token.Kind());\n\n public bool IsContextualKeyword(SyntaxToken token)\n => SyntaxFacts.IsContextualKeyword(token.Kind());\n\n public bool IsPreprocessorKeyword(SyntaxToken token)\n => SyntaxFacts.IsPreprocessorKeyword(token.Kind());\n\n public bool IsPreProcessorDirectiveContext(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)\n => syntaxTree.IsPreProcessorDirectiveContext(\n position, syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives: true), cancellationToken);\n\n public bool IsEntirelyWithinStringOrCharOrNumericLiteral([NotNullWhen(true)] SyntaxTree? syntaxTree, int position, CancellationToken cancellationToken)\n {\n if (syntaxTree == null)\n {\n return false;\n }\n\n return syntaxTree.IsEntirelyWithinStringOrCharLiteral(position, cancellationToken);\n }\n\n public bool IsDirective([NotNullWhen(true)] SyntaxNode? node)\n => node is DirectiveTriviaSyntax;\n\n public bool TryGetExternalSourceInfo([NotNullWhen(true)] SyntaxNode? node, out ExternalSourceInfo info)\n {\n if (node is LineDirectiveTriviaSyntax lineDirective)\n {\n if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword)\n {\n info = new ExternalSourceInfo(null, ends: true);\n return true;\n }\n else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken &&\n lineDirective.Line.Value is int)\n {\n info = new ExternalSourceInfo((int)lineDirective.Line.Value, false);\n return true;\n }\n }\n\n info = default;\n return false;\n }\n\n public bool IsNameOfSimpleMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n {\n var name = node as SimpleNameSyntax;\n return name.IsSimpleMemberAccessExpressionName();\n }\n\n public bool IsNameOfAnyMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent is MemberAccessExpressionSyntax memberAccess && memberAccess.Name == node;\n\n public bool IsNameOfMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node)\n {\n var name = node as SimpleNameSyntax;\n return name.IsMemberBindingExpressionName();\n }\n\n [return: NotNullIfNotNull(\"node\")]\n public SyntaxNode? GetStandaloneExpression(SyntaxNode? node)\n => node is ExpressionSyntax expression ? SyntaxFactory.GetStandaloneExpression(expression) : node;\n\n public SyntaxNode? GetRootConditionalAccessExpression(SyntaxNode? node)\n => node.GetRootConditionalAccessExpression();\n\n public bool IsDeclarationExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is DeclarationExpressionSyntax;\n\n public bool IsAttributeName(SyntaxNode node)\n => SyntaxFacts.IsAttributeName(node);\n\n public bool IsNamedArgument([NotNullWhen(true)] SyntaxNode? node)\n => node is ArgumentSyntax arg && arg.NameColon != null;\n\n public bool IsNameOfNamedArgument([NotNullWhen(true)] SyntaxNode? node)\n => node.CheckParent(p => p.Name == node);\n\n public SyntaxToken? GetNameOfParameter(SyntaxNode? node)\n => (node as ParameterSyntax)?.Identifier;\n\n public SyntaxNode? GetDefaultOfParameter(SyntaxNode node)\n => ((ParameterSyntax)node).Default;\n\n public SyntaxNode? GetParameterList(SyntaxNode node)\n => node.GetParameterList();\n\n public bool IsParameterList([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ParameterList, SyntaxKind.BracketedParameterList);\n\n public SyntaxToken GetIdentifierOfGenericName(SyntaxNode node)\n => ((GenericNameSyntax)node).Identifier;\n\n public bool IsUsingDirectiveName([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.UsingDirective, out UsingDirectiveSyntax? usingDirective) &&\n usingDirective.Name == node;\n\n public bool IsUsingAliasDirective([NotNullWhen(true)] SyntaxNode? node)\n => node is UsingDirectiveSyntax usingDirectiveNode && usingDirectiveNode.Alias != null;\n\n public void GetPartsOfUsingAliasDirective(SyntaxNode node, out SyntaxToken globalKeyword, out SyntaxToken alias, out SyntaxNode name)\n {\n var usingDirective = (UsingDirectiveSyntax)node;\n globalKeyword = usingDirective.GlobalKeyword;\n alias = usingDirective.Alias!.Name.Identifier;\n name = usingDirective.Name;\n }\n\n public bool IsDeconstructionForEachStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is ForEachVariableStatementSyntax;\n\n public bool IsDeconstructionAssignment([NotNullWhen(true)] SyntaxNode? node)\n => node is AssignmentExpressionSyntax assignment && assignment.IsDeconstruction();\n\n public Location GetDeconstructionReferenceLocation(SyntaxNode node)\n {\n return node switch\n {\n AssignmentExpressionSyntax assignment => assignment.Left.GetLocation(),\n ForEachVariableStatementSyntax @foreach => @foreach.Variable.GetLocation(),\n _ => throw ExceptionUtilities.UnexpectedValue(node.Kind()),\n };\n }\n\n public bool IsStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is StatementSyntax;\n\n public bool IsExecutableStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is StatementSyntax;\n\n public bool IsMethodBody([NotNullWhen(true)] SyntaxNode? node)\n {\n if (node is BlockSyntax ||\n node is ArrowExpressionClauseSyntax)\n {\n return node.Parent is BaseMethodDeclarationSyntax ||\n node.Parent is AccessorDeclarationSyntax;\n }\n\n return false;\n }\n\n public SyntaxNode? GetExpressionOfReturnStatement(SyntaxNode node)\n => ((ReturnStatementSyntax)node).Expression;\n\n public bool IsThisConstructorInitializer(SyntaxToken token)\n => token.Parent.IsKind(SyntaxKind.ThisConstructorInitializer, out ConstructorInitializerSyntax? constructorInit) &&\n constructorInit.ThisOrBaseKeyword == token;\n\n public bool IsBaseConstructorInitializer(SyntaxToken token)\n => token.Parent.IsKind(SyntaxKind.BaseConstructorInitializer, out ConstructorInitializerSyntax? constructorInit) &&\n constructorInit.ThisOrBaseKeyword == token;\n\n public bool IsQueryKeyword(SyntaxToken token)\n {\n switch (token.Kind())\n {\n case SyntaxKind.FromKeyword:\n case SyntaxKind.JoinKeyword:\n case SyntaxKind.LetKeyword:\n case SyntaxKind.OrderByKeyword:\n case SyntaxKind.WhereKeyword:\n case SyntaxKind.OnKeyword:\n case SyntaxKind.EqualsKeyword:\n case SyntaxKind.InKeyword:\n return token.Parent is QueryClauseSyntax;\n case SyntaxKind.ByKeyword:\n case SyntaxKind.GroupKeyword:\n case SyntaxKind.SelectKeyword:\n return token.Parent is SelectOrGroupClauseSyntax;\n case SyntaxKind.AscendingKeyword:\n case SyntaxKind.DescendingKeyword:\n return token.Parent is OrderingSyntax;\n case SyntaxKind.IntoKeyword:\n return token.Parent.IsKind(SyntaxKind.JoinIntoClause, SyntaxKind.QueryContinuation);\n default:\n return false;\n }\n }\n\n public bool IsPredefinedType(SyntaxToken token)\n => TryGetPredefinedType(token, out _);\n\n public bool IsPredefinedType(SyntaxToken token, PredefinedType type)\n => TryGetPredefinedType(token, out var actualType) && actualType == type;\n\n public bool TryGetPredefinedType(SyntaxToken token, out PredefinedType type)\n {\n type = GetPredefinedType(token);\n return type != PredefinedType.None;\n }\n\n private static PredefinedType GetPredefinedType(SyntaxToken token)\n {\n return (SyntaxKind)token.RawKind switch\n {\n SyntaxKind.BoolKeyword => PredefinedType.Boolean,\n SyntaxKind.ByteKeyword => PredefinedType.Byte,\n SyntaxKind.SByteKeyword => PredefinedType.SByte,\n SyntaxKind.IntKeyword => PredefinedType.Int32,\n SyntaxKind.UIntKeyword => PredefinedType.UInt32,\n SyntaxKind.ShortKeyword => PredefinedType.Int16,\n SyntaxKind.UShortKeyword => PredefinedType.UInt16,\n SyntaxKind.LongKeyword => PredefinedType.Int64,\n SyntaxKind.ULongKeyword => PredefinedType.UInt64,\n SyntaxKind.FloatKeyword => PredefinedType.Single,\n SyntaxKind.DoubleKeyword => PredefinedType.Double,\n SyntaxKind.DecimalKeyword => PredefinedType.Decimal,\n SyntaxKind.StringKeyword => PredefinedType.String,\n SyntaxKind.CharKeyword => PredefinedType.Char,\n SyntaxKind.ObjectKeyword => PredefinedType.Object,\n SyntaxKind.VoidKeyword => PredefinedType.Void,\n _ => PredefinedType.None,\n };\n }\n\n public bool IsPredefinedOperator(SyntaxToken token)\n => TryGetPredefinedOperator(token, out var actualOperator) && actualOperator != PredefinedOperator.None;\n\n public bool IsPredefinedOperator(SyntaxToken token, PredefinedOperator op)\n => TryGetPredefinedOperator(token, out var actualOperator) && actualOperator == op;\n\n public bool TryGetPredefinedOperator(SyntaxToken token, out PredefinedOperator op)\n {\n op = GetPredefinedOperator(token);\n return op != PredefinedOperator.None;\n }\n\n private static PredefinedOperator GetPredefinedOperator(SyntaxToken token)\n {\n switch ((SyntaxKind)token.RawKind)\n {\n case SyntaxKind.PlusToken:\n case SyntaxKind.PlusEqualsToken:\n return PredefinedOperator.Addition;\n\n case SyntaxKind.MinusToken:\n case SyntaxKind.MinusEqualsToken:\n return PredefinedOperator.Subtraction;\n\n case SyntaxKind.AmpersandToken:\n case SyntaxKind.AmpersandEqualsToken:\n return PredefinedOperator.BitwiseAnd;\n\n case SyntaxKind.BarToken:\n case SyntaxKind.BarEqualsToken:\n return PredefinedOperator.BitwiseOr;\n\n case SyntaxKind.MinusMinusToken:\n return PredefinedOperator.Decrement;\n\n case SyntaxKind.PlusPlusToken:\n return PredefinedOperator.Increment;\n\n case SyntaxKind.SlashToken:\n case SyntaxKind.SlashEqualsToken:\n return PredefinedOperator.Division;\n\n case SyntaxKind.EqualsEqualsToken:\n return PredefinedOperator.Equality;\n\n case SyntaxKind.CaretToken:\n case SyntaxKind.CaretEqualsToken:\n return PredefinedOperator.ExclusiveOr;\n\n case SyntaxKind.GreaterThanToken:\n return PredefinedOperator.GreaterThan;\n\n case SyntaxKind.GreaterThanEqualsToken:\n return PredefinedOperator.GreaterThanOrEqual;\n\n case SyntaxKind.ExclamationEqualsToken:\n return PredefinedOperator.Inequality;\n\n case SyntaxKind.LessThanLessThanToken:\n case SyntaxKind.LessThanLessThanEqualsToken:\n return PredefinedOperator.LeftShift;\n\n case SyntaxKind.LessThanToken:\n return PredefinedOperator.LessThan;\n\n case SyntaxKind.LessThanEqualsToken:\n return PredefinedOperator.LessThanOrEqual;\n\n case SyntaxKind.AsteriskToken:\n case SyntaxKind.AsteriskEqualsToken:\n return PredefinedOperator.Multiplication;\n\n case SyntaxKind.PercentToken:\n case SyntaxKind.PercentEqualsToken:\n return PredefinedOperator.Modulus;\n\n case SyntaxKind.ExclamationToken:\n case SyntaxKind.TildeToken:\n return PredefinedOperator.Complement;\n\n case SyntaxKind.GreaterThanGreaterThanToken:\n case SyntaxKind.GreaterThanGreaterThanEqualsToken:\n return PredefinedOperator.RightShift;\n }\n\n return PredefinedOperator.None;\n }\n\n public string GetText(int kind)\n => SyntaxFacts.GetText((SyntaxKind)kind);\n\n public bool IsIdentifierStartCharacter(char c)\n => SyntaxFacts.IsIdentifierStartCharacter(c);\n\n public bool IsIdentifierPartCharacter(char c)\n => SyntaxFacts.IsIdentifierPartCharacter(c);\n\n public bool IsIdentifierEscapeCharacter(char c)\n => c == '@';\n\n public bool IsValidIdentifier(string identifier)\n {\n var token = SyntaxFactory.ParseToken(identifier);\n return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length;\n }\n\n public bool IsVerbatimIdentifier(string identifier)\n {\n var token = SyntaxFactory.ParseToken(identifier);\n return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();\n }\n\n public bool IsTypeCharacter(char c) => false;\n\n public bool IsStartOfUnicodeEscapeSequence(char c)\n => c == '\\\\';\n\n public bool IsLiteral(SyntaxToken token)\n {\n switch (token.Kind())\n {\n case SyntaxKind.NumericLiteralToken:\n case SyntaxKind.CharacterLiteralToken:\n case SyntaxKind.StringLiteralToken:\n case SyntaxKind.NullKeyword:\n case SyntaxKind.TrueKeyword:\n case SyntaxKind.FalseKeyword:\n case SyntaxKind.InterpolatedStringStartToken:\n case SyntaxKind.InterpolatedStringEndToken:\n case SyntaxKind.InterpolatedVerbatimStringStartToken:\n case SyntaxKind.InterpolatedStringTextToken:\n return true;\n default:\n return false;\n }\n }\n\n public bool IsStringLiteralOrInterpolatedStringLiteral(SyntaxToken token)\n => token.IsKind(SyntaxKind.StringLiteralToken, SyntaxKind.InterpolatedStringTextToken);\n\n public bool IsBindableToken(SyntaxToken token)\n {\n if (this.IsWord(token) || this.IsLiteral(token) || this.IsOperator(token))\n {\n switch ((SyntaxKind)token.RawKind)\n {\n case SyntaxKind.DelegateKeyword:\n case SyntaxKind.VoidKeyword:\n return false;\n }\n\n return true;\n }\n\n // In the order by clause a comma might be bound to ThenBy or ThenByDescending\n if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause))\n {\n return true;\n }\n\n return false;\n }\n\n public bool IsPostfixUnaryExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is PostfixUnaryExpressionSyntax;\n\n public bool IsMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is MemberBindingExpressionSyntax;\n\n public bool IsPointerMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression;\n\n public void GetNameAndArityOfSimpleName(SyntaxNode node, out string name, out int arity)\n {\n var simpleName = (SimpleNameSyntax)node;\n name = simpleName.Identifier.ValueText;\n arity = simpleName.Arity;\n }\n\n public bool LooksGeneric(SyntaxNode simpleName)\n => simpleName.IsKind(SyntaxKind.GenericName) ||\n simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken;\n\n public SyntaxNode? GetTargetOfMemberBinding(SyntaxNode? node)\n => (node as MemberBindingExpressionSyntax).GetParentConditionalAccessExpression()?.Expression;\n\n public SyntaxNode GetNameOfMemberBindingExpression(SyntaxNode node)\n => ((MemberBindingExpressionSyntax)node).Name;\n\n public SyntaxNode? GetExpressionOfMemberAccessExpression(SyntaxNode node, bool allowImplicitTarget)\n => ((MemberAccessExpressionSyntax)node).Expression;\n\n public void GetPartsOfElementAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode argumentList)\n {\n var elementAccess = (ElementAccessExpressionSyntax)node;\n expression = elementAccess.Expression;\n argumentList = elementAccess.ArgumentList;\n }\n\n public SyntaxNode GetExpressionOfInterpolation(SyntaxNode node)\n => ((InterpolationSyntax)node).Expression;\n\n public bool IsInStaticContext(SyntaxNode node)\n => node.IsInStaticContext();\n\n public bool IsInNamespaceOrTypeContext([NotNullWhen(true)] SyntaxNode? node)\n => SyntaxFacts.IsInNamespaceOrTypeContext(node as ExpressionSyntax);\n\n public bool IsBaseTypeList([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.BaseList);\n\n public SyntaxNode GetExpressionOfArgument(SyntaxNode node)\n => ((ArgumentSyntax)node).Expression;\n\n public RefKind GetRefKindOfArgument(SyntaxNode node)\n => ((ArgumentSyntax)node).GetRefKind();\n\n public bool IsArgument([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Argument);\n\n public bool IsSimpleArgument([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is ArgumentSyntax argument &&\n argument.RefOrOutKeyword.Kind() == SyntaxKind.None &&\n argument.NameColon == null;\n }\n\n public bool IsInConstantContext([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsInConstantContext();\n\n public bool IsInConstructor(SyntaxNode node)\n => node.GetAncestor() != null;\n\n public bool IsUnsafeContext(SyntaxNode node)\n => node.IsUnsafeContext();\n\n public SyntaxNode GetNameOfAttribute(SyntaxNode node)\n => ((AttributeSyntax)node).Name;\n\n public bool IsAttributeNamedArgumentIdentifier([NotNullWhen(true)] SyntaxNode? node)\n => (node as IdentifierNameSyntax).IsAttributeNamedArgumentIdentifier();\n\n public SyntaxNode? GetContainingTypeDeclaration(SyntaxNode? root, int position)\n {\n if (root == null)\n {\n throw new ArgumentNullException(nameof(root));\n }\n\n if (position < 0 || position > root.Span.End)\n {\n throw new ArgumentOutOfRangeException(nameof(position));\n }\n\n return root\n .FindToken(position)\n .GetAncestors()\n .FirstOrDefault(n => n is BaseTypeDeclarationSyntax || n is DelegateDeclarationSyntax);\n }\n\n public SyntaxNode? GetContainingVariableDeclaratorOfFieldDeclaration(SyntaxNode? node)\n => throw ExceptionUtilities.Unreachable;\n\n public bool IsNameOfSubpattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IdentifierName) &&\n node.IsParentKind(SyntaxKind.NameColon) &&\n node.Parent.IsParentKind(SyntaxKind.Subpattern);\n\n public bool IsPropertyPatternClause(SyntaxNode node)\n => node.Kind() == SyntaxKind.PropertyPatternClause;\n\n public bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node)\n => IsMemberInitializerNamedAssignmentIdentifier(node, out _);\n\n public bool IsMemberInitializerNamedAssignmentIdentifier(\n [NotNullWhen(true)] SyntaxNode? node, [NotNullWhen(true)] out SyntaxNode? initializedInstance)\n {\n initializedInstance = null;\n if (node is IdentifierNameSyntax identifier &&\n identifier.IsLeftSideOfAssignExpression())\n {\n if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression))\n {\n var withInitializer = identifier.Parent.GetRequiredParent();\n initializedInstance = withInitializer.GetRequiredParent();\n return true;\n }\n else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression))\n {\n var objectInitializer = identifier.Parent.GetRequiredParent();\n if (objectInitializer.Parent is BaseObjectCreationExpressionSyntax)\n {\n initializedInstance = objectInitializer.Parent;\n return true;\n }\n else if (objectInitializer.IsParentKind(SyntaxKind.SimpleAssignmentExpression, out AssignmentExpressionSyntax? assignment))\n {\n initializedInstance = assignment.Left;\n return true;\n }\n }\n }\n\n return false;\n }\n\n public bool IsElementAccessExpression(SyntaxNode? node)\n => node.IsKind(SyntaxKind.ElementAccessExpression);\n\n [return: NotNullIfNotNull(\"node\")]\n public SyntaxNode? ConvertToSingleLine(SyntaxNode? node, bool useElasticTrivia = false)\n => node.ConvertToSingleLine(useElasticTrivia);\n\n public bool IsIndexerMemberCRef(SyntaxNode? node)\n => node.IsKind(SyntaxKind.IndexerMemberCref);\n\n public SyntaxNode? GetContainingMemberDeclaration(SyntaxNode? root, int position, bool useFullSpan = true)\n {\n Contract.ThrowIfNull(root, \"root\");\n Contract.ThrowIfTrue(position < 0 || position > root.FullSpan.End, \"position\");\n\n var end = root.FullSpan.End;\n if (end == 0)\n {\n // empty file\n return null;\n }\n\n // make sure position doesn't touch end of root\n position = Math.Min(position, end - 1);\n\n var node = root.FindToken(position).Parent;\n while (node != null)\n {\n if (useFullSpan || node.Span.Contains(position))\n {\n var kind = node.Kind();\n if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is MemberDeclarationSyntax))\n {\n return node;\n }\n }\n\n node = node.Parent;\n }\n\n return null;\n }\n\n public bool IsMethodLevelMember([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is BaseMethodDeclarationSyntax ||\n node is BasePropertyDeclarationSyntax ||\n node is EnumMemberDeclarationSyntax ||\n node is BaseFieldDeclarationSyntax;\n }\n\n public bool IsTopLevelNodeWithMembers([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is BaseNamespaceDeclarationSyntax ||\n node is TypeDeclarationSyntax ||\n node is EnumDeclarationSyntax;\n }\n\n private const string dotToken = \".\";\n\n public string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, string? rootNamespace = null)\n {\n if (node == null)\n {\n return string.Empty;\n }\n\n var pooled = PooledStringBuilder.GetInstance();\n var builder = pooled.Builder;\n\n // return type\n var memberDeclaration = node as MemberDeclarationSyntax;\n if ((options & DisplayNameOptions.IncludeType) != 0)\n {\n var type = memberDeclaration.GetMemberType();\n if (type != null && !type.IsMissing)\n {\n builder.Append(type);\n builder.Append(' ');\n }\n }\n\n var names = ArrayBuilder.GetInstance();\n // containing type(s)\n var parent = node.GetAncestor() ?? node.Parent;\n while (parent is TypeDeclarationSyntax)\n {\n names.Push(GetName(parent, options));\n parent = parent.Parent;\n }\n\n // containing namespace(s) in source (if any)\n if ((options & DisplayNameOptions.IncludeNamespaces) != 0)\n {\n while (parent is BaseNamespaceDeclarationSyntax)\n {\n names.Add(GetName(parent, options));\n parent = parent.Parent;\n }\n }\n\n while (!names.IsEmpty())\n {\n var name = names.Pop();\n if (name != null)\n {\n builder.Append(name);\n builder.Append(dotToken);\n }\n }\n\n // name (including generic type parameters)\n builder.Append(GetName(node, options));\n\n // parameter list (if any)\n if ((options & DisplayNameOptions.IncludeParameters) != 0)\n {\n builder.Append(memberDeclaration.GetParameterList());\n }\n\n return pooled.ToStringAndFree();\n }\n\n private static string? GetName(SyntaxNode node, DisplayNameOptions options)\n {\n const string missingTokenPlaceholder = \"?\";\n\n switch (node.Kind())\n {\n case SyntaxKind.CompilationUnit:\n return null;\n case SyntaxKind.IdentifierName:\n var identifier = ((IdentifierNameSyntax)node).Identifier;\n return identifier.IsMissing ? missingTokenPlaceholder : identifier.Text;\n case SyntaxKind.IncompleteMember:\n return missingTokenPlaceholder;\n case SyntaxKind.NamespaceDeclaration:\n case SyntaxKind.FileScopedNamespaceDeclaration:\n return GetName(((BaseNamespaceDeclarationSyntax)node).Name, options);\n case SyntaxKind.QualifiedName:\n var qualified = (QualifiedNameSyntax)node;\n return GetName(qualified.Left, options) + dotToken + GetName(qualified.Right, options);\n }\n\n string? name = null;\n if (node is MemberDeclarationSyntax memberDeclaration)\n {\n if (memberDeclaration.Kind() == SyntaxKind.ConversionOperatorDeclaration)\n {\n name = (memberDeclaration as ConversionOperatorDeclarationSyntax)?.Type.ToString();\n }\n else\n {\n var nameToken = memberDeclaration.GetNameToken();\n if (nameToken != default)\n {\n name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;\n if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration)\n {\n name = \"~\" + name;\n }\n\n if ((options & DisplayNameOptions.IncludeTypeParameters) != 0)\n {\n var pooled = PooledStringBuilder.GetInstance();\n var builder = pooled.Builder;\n builder.Append(name);\n AppendTypeParameterList(builder, memberDeclaration.GetTypeParameterList());\n name = pooled.ToStringAndFree();\n }\n }\n else\n {\n Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember);\n name = \"?\";\n }\n }\n }\n else\n {\n if (node is VariableDeclaratorSyntax fieldDeclarator)\n {\n var nameToken = fieldDeclarator.Identifier;\n if (nameToken != default)\n {\n name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;\n }\n }\n }\n\n Debug.Assert(name != null, \"Unexpected node type \" + node.Kind());\n return name;\n }\n\n private static void AppendTypeParameterList(StringBuilder builder, TypeParameterListSyntax typeParameterList)\n {\n if (typeParameterList != null && typeParameterList.Parameters.Count > 0)\n {\n builder.Append('<');\n builder.Append(typeParameterList.Parameters[0].Identifier.ValueText);\n for (var i = 1; i < typeParameterList.Parameters.Count; i++)\n {\n builder.Append(\", \");\n builder.Append(typeParameterList.Parameters[i].Identifier.ValueText);\n }\n\n builder.Append('>');\n }\n }\n\n public List GetTopLevelAndMethodLevelMembers(SyntaxNode? root)\n {\n var list = new List();\n AppendMembers(root, list, topLevel: true, methodLevel: true);\n return list;\n }\n\n public List GetMethodLevelMembers(SyntaxNode? root)\n {\n var list = new List();\n AppendMembers(root, list, topLevel: false, methodLevel: true);\n return list;\n }\n\n public SyntaxList GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration)\n => ((TypeDeclarationSyntax)typeDeclaration).Members;\n\n private void AppendMembers(SyntaxNode? node, List list, bool topLevel, bool methodLevel)\n {\n Debug.Assert(topLevel || methodLevel);\n\n foreach (var member in node.GetMembers())\n {\n if (IsTopLevelNodeWithMembers(member))\n {\n if (topLevel)\n {\n list.Add(member);\n }\n\n AppendMembers(member, list, topLevel, methodLevel);\n continue;\n }\n\n if (methodLevel && IsMethodLevelMember(member))\n {\n list.Add(member);\n }\n }\n }\n\n public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node)\n {\n if (node.Span.IsEmpty)\n {\n return default;\n }\n\n var member = GetContainingMemberDeclaration(node, node.SpanStart);\n if (member == null)\n {\n return default;\n }\n\n // TODO: currently we only support method for now\n if (member is BaseMethodDeclarationSyntax method)\n {\n if (method.Body == null)\n {\n return default;\n }\n\n return GetBlockBodySpan(method.Body);\n }\n\n return default;\n }\n\n public bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span)\n {\n switch (node)\n {\n case ConstructorDeclarationSyntax constructor:\n return (constructor.Body != null && GetBlockBodySpan(constructor.Body).Contains(span)) ||\n (constructor.Initializer != null && constructor.Initializer.Span.Contains(span));\n case BaseMethodDeclarationSyntax method:\n return method.Body != null && GetBlockBodySpan(method.Body).Contains(span);\n case BasePropertyDeclarationSyntax property:\n return property.AccessorList != null && property.AccessorList.Span.Contains(span);\n case EnumMemberDeclarationSyntax @enum:\n return @enum.EqualsValue != null && @enum.EqualsValue.Span.Contains(span);\n case BaseFieldDeclarationSyntax field:\n return field.Declaration != null && field.Declaration.Span.Contains(span);\n }\n\n return false;\n }\n\n private static TextSpan GetBlockBodySpan(BlockSyntax body)\n => TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart);\n\n public SyntaxNode? TryGetBindableParent(SyntaxToken token)\n {\n var node = token.Parent;\n while (node != null)\n {\n var parent = node.Parent;\n\n // If this node is on the left side of a member access expression, don't ascend\n // further or we'll end up binding to something else.\n if (parent is MemberAccessExpressionSyntax memberAccess)\n {\n if (memberAccess.Expression == node)\n {\n break;\n }\n }\n\n // If this node is on the left side of a qualified name, don't ascend\n // further or we'll end up binding to something else.\n if (parent is QualifiedNameSyntax qualifiedName)\n {\n if (qualifiedName.Left == node)\n {\n break;\n }\n }\n\n // If this node is on the left side of a alias-qualified name, don't ascend\n // further or we'll end up binding to something else.\n if (parent is AliasQualifiedNameSyntax aliasQualifiedName)\n {\n if (aliasQualifiedName.Alias == node)\n {\n break;\n }\n }\n\n // If this node is the type of an object creation expression, return the\n // object creation expression.\n if (parent is ObjectCreationExpressionSyntax objectCreation)\n {\n if (objectCreation.Type == node)\n {\n node = parent;\n break;\n }\n }\n\n // The inside of an interpolated string is treated as its own token so we\n // need to force navigation to the parent expression syntax.\n if (node is InterpolatedStringTextSyntax && parent is InterpolatedStringExpressionSyntax)\n {\n node = parent;\n break;\n }\n\n // If this node is not parented by a name, we're done.\n if (!(parent is NameSyntax))\n {\n break;\n }\n\n node = parent;\n }\n\n if (node is VarPatternSyntax)\n {\n return node;\n }\n\n // Patterns are never bindable (though their constituent types/exprs may be).\n return node is PatternSyntax ? null : node;\n }\n\n public IEnumerable GetConstructors(SyntaxNode? root, CancellationToken cancellationToken)\n {\n if (root is not CompilationUnitSyntax compilationUnit)\n {\n return SpecializedCollections.EmptyEnumerable();\n }\n\n var constructors = new List();\n AppendConstructors(compilationUnit.Members, constructors, cancellationToken);\n return constructors;\n }\n\n private void AppendConstructors(SyntaxList members, List constructors, CancellationToken cancellationToken)\n {\n foreach (var member in members)\n {\n cancellationToken.ThrowIfCancellationRequested();\n switch (member)\n {\n case ConstructorDeclarationSyntax constructor:\n constructors.Add(constructor);\n continue;\n case BaseNamespaceDeclarationSyntax @namespace:\n AppendConstructors(@namespace.Members, constructors, cancellationToken);\n break;\n case ClassDeclarationSyntax @class:\n AppendConstructors(@class.Members, constructors, cancellationToken);\n break;\n case RecordDeclarationSyntax record:\n AppendConstructors(record.Members, constructors, cancellationToken);\n break;\n case StructDeclarationSyntax @struct:\n AppendConstructors(@struct.Members, constructors, cancellationToken);\n break;\n }\n }\n }\n\n public bool TryGetCorrespondingOpenBrace(SyntaxToken token, out SyntaxToken openBrace)\n {\n if (token.Kind() == SyntaxKind.CloseBraceToken)\n {\n var tuple = token.Parent.GetBraces();\n\n openBrace = tuple.openBrace;\n return openBrace.Kind() == SyntaxKind.OpenBraceToken;\n }\n\n openBrace = default;\n return false;\n }\n\n public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)\n {\n var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);\n if (trivia.Kind() == SyntaxKind.DisabledTextTrivia)\n {\n return trivia.FullSpan;\n }\n\n var token = syntaxTree.FindTokenOrEndToken(position, cancellationToken);\n if (token.Kind() == SyntaxKind.EndOfFileToken)\n {\n var triviaList = token.LeadingTrivia;\n foreach (var triviaTok in triviaList.Reverse())\n {\n if (triviaTok.Span.Contains(position))\n {\n return default;\n }\n\n if (triviaTok.Span.End < position)\n {\n if (!triviaTok.HasStructure)\n {\n return default;\n }\n\n var structure = triviaTok.GetStructure();\n if (structure is BranchingDirectiveTriviaSyntax branch)\n {\n return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default;\n }\n }\n }\n }\n\n return default;\n }\n\n public string GetNameForArgument(SyntaxNode? argument)\n => (argument as ArgumentSyntax)?.NameColon?.Name.Identifier.ValueText ?? string.Empty;\n\n public string GetNameForAttributeArgument(SyntaxNode? argument)\n => (argument as AttributeArgumentSyntax)?.NameEquals?.Name.Identifier.ValueText ?? string.Empty;\n\n public bool IsLeftSideOfDot([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfDot();\n\n public SyntaxNode? GetRightSideOfDot(SyntaxNode? node)\n {\n return (node as QualifiedNameSyntax)?.Right ??\n (node as MemberAccessExpressionSyntax)?.Name;\n }\n\n public SyntaxNode? GetLeftSideOfDot(SyntaxNode? node, bool allowImplicitTarget)\n {\n return (node as QualifiedNameSyntax)?.Left ??\n (node as MemberAccessExpressionSyntax)?.Expression;\n }\n\n public bool IsLeftSideOfExplicitInterfaceSpecifier([NotNullWhen(true)] SyntaxNode? node)\n => (node as NameSyntax).IsLeftSideOfExplicitInterfaceSpecifier();\n\n public bool IsLeftSideOfAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfAssignExpression();\n\n public bool IsLeftSideOfAnyAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfAnyAssignExpression();\n\n public bool IsLeftSideOfCompoundAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfCompoundAssignExpression();\n\n public SyntaxNode GetRightHandSideOfAssignment(SyntaxNode node)\n => ((AssignmentExpressionSyntax)node).Right;\n\n public bool IsInferredAnonymousObjectMemberDeclarator([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.AnonymousObjectMemberDeclarator, out AnonymousObjectMemberDeclaratorSyntax? anonObject) &&\n anonObject.NameEquals == null;\n\n public bool IsOperandOfIncrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.PostIncrementExpression) ||\n node.IsParentKind(SyntaxKind.PreIncrementExpression);\n\n public static bool IsOperandOfDecrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.PostDecrementExpression) ||\n node.IsParentKind(SyntaxKind.PreDecrementExpression);\n\n public bool IsOperandOfIncrementOrDecrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => IsOperandOfIncrementExpression(node) || IsOperandOfDecrementExpression(node);\n\n public SyntaxList GetContentsOfInterpolatedString(SyntaxNode interpolatedString)\n => ((InterpolatedStringExpressionSyntax)interpolatedString).Contents;\n\n public bool IsVerbatimStringLiteral(SyntaxToken token)\n => token.IsVerbatimStringLiteral();\n\n public bool IsNumericLiteral(SyntaxToken token)\n => token.Kind() == SyntaxKind.NumericLiteralToken;\n\n public SeparatedSyntaxList GetArgumentsOfInvocationExpression(SyntaxNode invocationExpression)\n => GetArgumentsOfArgumentList(((InvocationExpressionSyntax)invocationExpression).ArgumentList);\n\n public SeparatedSyntaxList GetArgumentsOfObjectCreationExpression(SyntaxNode objectCreationExpression)\n => ((BaseObjectCreationExpressionSyntax)objectCreationExpression).ArgumentList is { } argumentList\n ? GetArgumentsOfArgumentList(argumentList)\n : default;\n\n public SeparatedSyntaxList GetArgumentsOfArgumentList(SyntaxNode argumentList)\n => ((BaseArgumentListSyntax)argumentList).Arguments;\n\n public bool IsRegularComment(SyntaxTrivia trivia)\n => trivia.IsRegularComment();\n\n public bool IsDocumentationComment(SyntaxTrivia trivia)\n => trivia.IsDocComment();\n\n public bool IsElastic(SyntaxTrivia trivia)\n => trivia.IsElastic();\n\n public bool IsPragmaDirective(SyntaxTrivia trivia, out bool isDisable, out bool isActive, out SeparatedSyntaxList errorCodes)\n => trivia.IsPragmaDirective(out isDisable, out isActive, out errorCodes);\n\n public bool IsDocumentationCommentExteriorTrivia(SyntaxTrivia trivia)\n => trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia;\n\n public bool IsDocumentationComment(SyntaxNode node)\n => SyntaxFacts.IsDocumentationCommentTrivia(node.Kind());\n\n public bool IsUsingOrExternOrImport([NotNullWhen(true)] SyntaxNode? node)\n {\n return node.IsKind(SyntaxKind.UsingDirective) ||\n node.IsKind(SyntaxKind.ExternAliasDirective);\n }\n\n public bool IsGlobalAssemblyAttribute([NotNullWhen(true)] SyntaxNode? node)\n => IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword);\n\n public bool IsGlobalModuleAttribute([NotNullWhen(true)] SyntaxNode? node)\n => IsGlobalAttribute(node, SyntaxKind.ModuleKeyword);\n\n private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget)\n => node.IsKind(SyntaxKind.Attribute) &&\n node.Parent.IsKind(SyntaxKind.AttributeList, out AttributeListSyntax? attributeList) &&\n attributeList.Target?.Identifier.Kind() == attributeTarget;\n\n private static bool IsMemberDeclaration(SyntaxNode node)\n {\n // From the C# language spec:\n // class-member-declaration:\n // constant-declaration\n // field-declaration\n // method-declaration\n // property-declaration\n // event-declaration\n // indexer-declaration\n // operator-declaration\n // constructor-declaration\n // destructor-declaration\n // static-constructor-declaration\n // type-declaration\n switch (node.Kind())\n {\n // Because fields declarations can define multiple symbols \"public int a, b;\"\n // We want to get the VariableDeclarator node inside the field declaration to print out the symbol for the name.\n case SyntaxKind.VariableDeclarator:\n return node.Parent.IsParentKind(SyntaxKind.FieldDeclaration) ||\n node.Parent.IsParentKind(SyntaxKind.EventFieldDeclaration);\n\n case SyntaxKind.FieldDeclaration:\n case SyntaxKind.MethodDeclaration:\n case SyntaxKind.PropertyDeclaration:\n case SyntaxKind.GetAccessorDeclaration:\n case SyntaxKind.SetAccessorDeclaration:\n case SyntaxKind.EventDeclaration:\n case SyntaxKind.EventFieldDeclaration:\n case SyntaxKind.AddAccessorDeclaration:\n case SyntaxKind.RemoveAccessorDeclaration:\n case SyntaxKind.IndexerDeclaration:\n case SyntaxKind.OperatorDeclaration:\n case SyntaxKind.ConversionOperatorDeclaration:\n case SyntaxKind.ConstructorDeclaration:\n case SyntaxKind.DestructorDeclaration:\n return true;\n\n default:\n return false;\n }\n }\n\n public bool IsDeclaration(SyntaxNode node)\n => SyntaxFacts.IsNamespaceMemberDeclaration(node.Kind()) || IsMemberDeclaration(node);\n\n public bool IsTypeDeclaration(SyntaxNode node)\n => SyntaxFacts.IsTypeDeclaration(node.Kind());\n\n public bool IsSimpleAssignmentStatement([NotNullWhen(true)] SyntaxNode? statement)\n => statement.IsKind(SyntaxKind.ExpressionStatement, out ExpressionStatementSyntax? exprStatement) &&\n exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);\n\n public void GetPartsOfAssignmentStatement(\n SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n GetPartsOfAssignmentExpressionOrStatement(\n ((ExpressionStatementSyntax)statement).Expression, out left, out operatorToken, out right);\n }\n\n public void GetPartsOfAssignmentExpressionOrStatement(\n SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var expression = statement;\n if (statement is ExpressionStatementSyntax expressionStatement)\n {\n expression = expressionStatement.Expression;\n }\n\n var assignment = (AssignmentExpressionSyntax)expression;\n left = assignment.Left;\n operatorToken = assignment.OperatorToken;\n right = assignment.Right;\n }\n\n public SyntaxToken GetIdentifierOfSimpleName(SyntaxNode node)\n => ((SimpleNameSyntax)node).Identifier;\n\n public SyntaxToken GetIdentifierOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclaratorSyntax)node).Identifier;\n\n public SyntaxToken GetIdentifierOfParameter(SyntaxNode node)\n => ((ParameterSyntax)node).Identifier;\n\n public SyntaxToken GetIdentifierOfTypeDeclaration(SyntaxNode node)\n => node switch\n {\n BaseTypeDeclarationSyntax typeDecl => typeDecl.Identifier,\n DelegateDeclarationSyntax delegateDecl => delegateDecl.Identifier,\n _ => throw ExceptionUtilities.UnexpectedValue(node),\n };\n\n public SyntaxToken GetIdentifierOfIdentifierName(SyntaxNode node)\n => ((IdentifierNameSyntax)node).Identifier;\n\n public bool IsDeclaratorOfLocalDeclarationStatement(SyntaxNode declarator, SyntaxNode localDeclarationStatement)\n {\n return ((LocalDeclarationStatementSyntax)localDeclarationStatement).Declaration.Variables.Contains(\n (VariableDeclaratorSyntax)declarator);\n }\n\n public bool AreEquivalent(SyntaxToken token1, SyntaxToken token2)\n => SyntaxFactory.AreEquivalent(token1, token2);\n\n public bool AreEquivalent(SyntaxNode? node1, SyntaxNode? node2)\n => SyntaxFactory.AreEquivalent(node1, node2);\n\n public static SyntaxNode GetExpressionOfInvocationExpression(SyntaxNode node)\n => ((InvocationExpressionSyntax)node).Expression;\n\n public bool IsExpressionOfForeach([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent is ForEachStatementSyntax foreachStatement && foreachStatement.Expression == node;\n\n public SyntaxNode GetExpressionOfExpressionStatement(SyntaxNode node)\n => ((ExpressionStatementSyntax)node).Expression;\n\n public bool IsIsExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IsExpression);\n\n [return: NotNullIfNotNull(\"node\")]\n public SyntaxNode? WalkDownParentheses(SyntaxNode? node)\n => (node as ExpressionSyntax)?.WalkDownParentheses() ?? node;\n\n public void GetPartsOfTupleExpression(SyntaxNode node,\n out SyntaxToken openParen, out SeparatedSyntaxList arguments, out SyntaxToken closeParen) where TArgumentSyntax : SyntaxNode\n {\n var tupleExpression = (TupleExpressionSyntax)node;\n openParen = tupleExpression.OpenParenToken;\n arguments = (SeparatedSyntaxList)tupleExpression.Arguments;\n closeParen = tupleExpression.CloseParenToken;\n }\n\n public override bool IsPreprocessorDirective(SyntaxTrivia trivia)\n => SyntaxFacts.IsPreprocessorDirective(trivia.Kind());\n\n public override bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)\n => token.ContainsInterleavedDirective(span, cancellationToken);\n\n public SyntaxTokenList GetModifiers(SyntaxNode? node)\n => node.GetModifiers();\n\n public SyntaxNode? WithModifiers(SyntaxNode? node, SyntaxTokenList modifiers)\n => node.WithModifiers(modifiers);\n\n public SeparatedSyntaxList GetVariablesOfLocalDeclarationStatement(SyntaxNode node)\n => ((LocalDeclarationStatementSyntax)node).Declaration.Variables;\n\n public SyntaxNode? GetInitializerOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclaratorSyntax)node).Initializer;\n\n public SyntaxNode GetTypeOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclarationSyntax)((VariableDeclaratorSyntax)node).Parent!).Type;\n\n public SyntaxNode? GetValueOfEqualsValueClause(SyntaxNode? node)\n => ((EqualsValueClauseSyntax?)node)?.Value;\n\n public bool IsScopeBlock([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Block);\n\n public bool IsExecutableBlock([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Block, SyntaxKind.SwitchSection, SyntaxKind.CompilationUnit);\n\n public IReadOnlyList GetExecutableBlockStatements(SyntaxNode? node)\n {\n return node switch\n {\n BlockSyntax block => block.Statements,\n SwitchSectionSyntax switchSection => switchSection.Statements,\n CompilationUnitSyntax compilationUnit => compilationUnit.Members.OfType().SelectAsArray(globalStatement => globalStatement.Statement),\n _ => throw ExceptionUtilities.UnexpectedValue(node),\n };\n }\n\n public SyntaxNode? FindInnermostCommonExecutableBlock(IEnumerable nodes)\n => nodes.FindInnermostCommonNode(node => IsExecutableBlock(node));\n\n public bool IsStatementContainer([NotNullWhen(true)] SyntaxNode? node)\n => IsExecutableBlock(node) || node.IsEmbeddedStatementOwner();\n\n public IReadOnlyList GetStatementContainerStatements(SyntaxNode? node)\n {\n if (IsExecutableBlock(node))\n return GetExecutableBlockStatements(node);\n else if (node.GetEmbeddedStatement() is { } embeddedStatement)\n return ImmutableArray.Create(embeddedStatement);\n else\n return ImmutableArray.Empty;\n }\n\n public bool IsConversionExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is CastExpressionSyntax;\n\n public bool IsCastExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is CastExpressionSyntax;\n\n public void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode expression)\n {\n var cast = (CastExpressionSyntax)node;\n type = cast.Type;\n expression = cast.Expression;\n }\n\n public SyntaxToken? GetDeclarationIdentifierIfOverride(SyntaxToken token)\n {\n if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member)\n {\n return member.GetNameToken();\n }\n\n return null;\n }\n\n public override SyntaxList GetAttributeLists(SyntaxNode? node)\n => node.GetAttributeLists();\n\n public override bool IsParameterNameXmlElementSyntax([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.XmlElement, out XmlElementSyntax? xmlElement) &&\n xmlElement.StartTag.Name.LocalName.ValueText == DocumentationCommentXmlNames.ParameterElementName;\n\n public override SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia)\n {\n if (trivia.GetStructure() is DocumentationCommentTriviaSyntax documentationCommentTrivia)\n {\n return documentationCommentTrivia.Content;\n }\n\n throw ExceptionUtilities.UnexpectedValue(trivia.Kind());\n }\n\n public bool IsIsPatternExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IsPatternExpression);\n\n public void GetPartsOfIsPatternExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken isToken, out SyntaxNode right)\n {\n var isPatternExpression = (IsPatternExpressionSyntax)node;\n left = isPatternExpression.Expression;\n isToken = isPatternExpression.IsKeyword;\n right = isPatternExpression.Pattern;\n }\n\n public bool IsAnyPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is PatternSyntax;\n\n public bool IsConstantPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ConstantPattern);\n\n public bool IsDeclarationPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.DeclarationPattern);\n\n public bool IsRecursivePattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.RecursivePattern);\n\n public bool IsVarPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.VarPattern);\n\n public SyntaxNode GetExpressionOfConstantPattern(SyntaxNode node)\n => ((ConstantPatternSyntax)node).Expression;\n\n public void GetPartsOfDeclarationPattern(SyntaxNode node, out SyntaxNode type, out SyntaxNode designation)\n {\n var declarationPattern = (DeclarationPatternSyntax)node;\n type = declarationPattern.Type;\n designation = declarationPattern.Designation;\n }\n\n public void GetPartsOfRecursivePattern(SyntaxNode node, out SyntaxNode? type, out SyntaxNode? positionalPart, out SyntaxNode? propertyPart, out SyntaxNode? designation)\n {\n var recursivePattern = (RecursivePatternSyntax)node;\n type = recursivePattern.Type;\n positionalPart = recursivePattern.PositionalPatternClause;\n propertyPart = recursivePattern.PropertyPatternClause;\n designation = recursivePattern.Designation;\n }\n\n public bool SupportsNotPattern(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion.IsCSharp9OrAbove();\n\n public bool IsAndPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.AndPattern);\n\n public bool IsBinaryPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is BinaryPatternSyntax;\n\n public bool IsNotPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.NotPattern);\n\n public bool IsOrPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.OrPattern);\n\n public bool IsParenthesizedPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ParenthesizedPattern);\n\n public bool IsTypePattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.TypePattern);\n\n public bool IsUnaryPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is UnaryPatternSyntax;\n\n public void GetPartsOfParenthesizedPattern(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode pattern, out SyntaxToken closeParen)\n {\n var parenthesizedPattern = (ParenthesizedPatternSyntax)node;\n openParen = parenthesizedPattern.OpenParenToken;\n pattern = parenthesizedPattern.Pattern;\n closeParen = parenthesizedPattern.CloseParenToken;\n }\n\n public void GetPartsOfBinaryPattern(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var binaryPattern = (BinaryPatternSyntax)node;\n left = binaryPattern.Left;\n operatorToken = binaryPattern.OperatorToken;\n right = binaryPattern.Right;\n }\n\n public void GetPartsOfUnaryPattern(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode pattern)\n {\n var unaryPattern = (UnaryPatternSyntax)node;\n operatorToken = unaryPattern.OperatorToken;\n pattern = unaryPattern.Pattern;\n }\n\n public SyntaxNode GetTypeOfTypePattern(SyntaxNode node)\n => ((TypePatternSyntax)node).Type;\n\n public void GetPartsOfInterpolationExpression(SyntaxNode node,\n out SyntaxToken stringStartToken, out SyntaxList contents, out SyntaxToken stringEndToken)\n {\n var interpolatedStringExpression = (InterpolatedStringExpressionSyntax)node;\n stringStartToken = interpolatedStringExpression.StringStartToken;\n contents = interpolatedStringExpression.Contents;\n stringEndToken = interpolatedStringExpression.StringEndToken;\n }\n\n public bool IsVerbatimInterpolatedStringExpression(SyntaxNode node)\n => node is InterpolatedStringExpressionSyntax interpolatedString &&\n interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken);\n\n #region IsXXX members\n\n public bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is AnonymousFunctionExpressionSyntax;\n\n public bool IsBaseNamespaceDeclaration([NotNullWhen(true)] SyntaxNode? node)\n => node is BaseNamespaceDeclarationSyntax;\n\n public bool IsBinaryExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is BinaryExpressionSyntax;\n\n public bool IsLiteralExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is LiteralExpressionSyntax;\n\n public bool IsMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is MemberAccessExpressionSyntax;\n\n public bool IsSimpleName([NotNullWhen(true)] SyntaxNode? node)\n => node is SimpleNameSyntax;\n\n #endregion\n\n #region GetPartsOfXXX members\n\n public void GetPartsOfBinaryExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var binaryExpression = (BinaryExpressionSyntax)node;\n left = binaryExpression.Left;\n operatorToken = binaryExpression.OperatorToken;\n right = binaryExpression.Right;\n }\n\n public void GetPartsOfCompilationUnit(SyntaxNode node, out SyntaxList imports, out SyntaxList attributeLists, out SyntaxList members)\n {\n var compilationUnit = (CompilationUnitSyntax)node;\n imports = compilationUnit.Usings;\n attributeLists = compilationUnit.AttributeLists;\n members = compilationUnit.Members;\n }\n\n public void GetPartsOfConditionalAccessExpression(\n SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode whenNotNull)\n {\n var conditionalAccess = (ConditionalAccessExpressionSyntax)node;\n expression = conditionalAccess.Expression;\n operatorToken = conditionalAccess.OperatorToken;\n whenNotNull = conditionalAccess.WhenNotNull;\n }\n\n public void GetPartsOfConditionalExpression(SyntaxNode node, out SyntaxNode condition, out SyntaxNode whenTrue, out SyntaxNode whenFalse)\n {\n var conditionalExpression = (ConditionalExpressionSyntax)node;\n condition = conditionalExpression.Condition;\n whenTrue = conditionalExpression.WhenTrue;\n whenFalse = conditionalExpression.WhenFalse;\n }\n\n public void GetPartsOfInvocationExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode? argumentList)\n {\n var invocation = (InvocationExpressionSyntax)node;\n expression = invocation.Expression;\n argumentList = invocation.ArgumentList;\n }\n\n public void GetPartsOfMemberAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode name)\n {\n var memberAccess = (MemberAccessExpressionSyntax)node;\n expression = memberAccess.Expression;\n operatorToken = memberAccess.OperatorToken;\n name = memberAccess.Name;\n }\n\n public void GetPartsOfBaseNamespaceDeclaration(SyntaxNode node, out SyntaxNode name, out SyntaxList imports, out SyntaxList members)\n {\n var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)node;\n name = namespaceDeclaration.Name;\n imports = namespaceDeclaration.Usings;\n members = namespaceDeclaration.Members;\n }\n\n public void GetPartsOfObjectCreationExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode? argumentList, out SyntaxNode? initializer)\n {\n var objectCreationExpression = (ObjectCreationExpressionSyntax)node;\n type = objectCreationExpression.Type;\n argumentList = objectCreationExpression.ArgumentList;\n initializer = objectCreationExpression.Initializer;\n }\n\n public void GetPartsOfParenthesizedExpression(\n SyntaxNode node, out SyntaxToken openParen, out SyntaxNode expression, out SyntaxToken closeParen)\n {\n var parenthesizedExpression = (ParenthesizedExpressionSyntax)node;\n openParen = parenthesizedExpression.OpenParenToken;\n expression = parenthesizedExpression.Expression;\n closeParen = parenthesizedExpression.CloseParenToken;\n }\n\n public void GetPartsOfPrefixUnaryExpression(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode operand)\n {\n var prefixUnaryExpression = (PrefixUnaryExpressionSyntax)node;\n operatorToken = prefixUnaryExpression.OperatorToken;\n operand = prefixUnaryExpression.Operand;\n }\n\n public void GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var qualifiedName = (QualifiedNameSyntax)node;\n left = qualifiedName.Left;\n operatorToken = qualifiedName.DotToken;\n right = qualifiedName.Right;\n }\n\n #endregion\n\n #region GetXXXOfYYY members\n\n public SyntaxNode GetExpressionOfAwaitExpression(SyntaxNode node)\n => ((AwaitExpressionSyntax)node).Expression;\n\n public SyntaxNode GetExpressionOfThrowExpression(SyntaxNode node)\n => ((ThrowExpressionSyntax)node).Expression;\n\n #endregion\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.LanguageServices;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\nusing Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;\nusing Microsoft.CodeAnalysis.CSharp.Shared.Extensions;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.CSharp.LanguageServices\n{\n internal class CSharpSyntaxFacts : AbstractSyntaxFacts, ISyntaxFacts\n {\n internal static readonly CSharpSyntaxFacts Instance = new();\n\n protected CSharpSyntaxFacts()\n {\n }\n\n public override bool IsCaseSensitive => true;\n\n public override StringComparer StringComparer { get; } = StringComparer.Ordinal;\n\n public override SyntaxTrivia ElasticMarker\n => SyntaxFactory.ElasticMarker;\n\n public override SyntaxTrivia ElasticCarriageReturnLineFeed\n => SyntaxFactory.ElasticCarriageReturnLineFeed;\n\n public override ISyntaxKinds SyntaxKinds { get; } = CSharpSyntaxKinds.Instance;\n\n public override bool SupportsIndexingInitializer(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp6;\n\n public override bool SupportsThrowExpression(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp7;\n\n public override bool SupportsLocalFunctionDeclaration(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp7;\n\n public override bool SupportsRecord(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp9;\n\n public override bool SupportsRecordStruct(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion.IsCSharp10OrAbove();\n\n public override SyntaxToken ParseToken(string text)\n => SyntaxFactory.ParseToken(text);\n\n public override SyntaxTriviaList ParseLeadingTrivia(string text)\n => SyntaxFactory.ParseLeadingTrivia(text);\n\n public override string EscapeIdentifier(string identifier)\n {\n var nullIndex = identifier.IndexOf('\\0');\n if (nullIndex >= 0)\n {\n identifier = identifier.Substring(0, nullIndex);\n }\n\n var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None;\n return needsEscaping ? \"@\" + identifier : identifier;\n }\n\n public override bool IsVerbatimIdentifier(SyntaxToken token)\n => token.IsVerbatimIdentifier();\n\n public override bool IsOperator(SyntaxToken token)\n {\n var kind = token.Kind();\n\n return\n (SyntaxFacts.IsAnyUnaryExpression(kind) &&\n (token.Parent is PrefixUnaryExpressionSyntax || token.Parent is PostfixUnaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) ||\n (SyntaxFacts.IsBinaryExpression(kind) && (token.Parent is BinaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) ||\n (SyntaxFacts.IsAssignmentExpressionOperatorToken(kind) && token.Parent is AssignmentExpressionSyntax);\n }\n\n public override bool IsReservedKeyword(SyntaxToken token)\n => SyntaxFacts.IsReservedKeyword(token.Kind());\n\n public override bool IsContextualKeyword(SyntaxToken token)\n => SyntaxFacts.IsContextualKeyword(token.Kind());\n\n public override bool IsPreprocessorKeyword(SyntaxToken token)\n => SyntaxFacts.IsPreprocessorKeyword(token.Kind());\n\n public override bool IsPreProcessorDirectiveContext(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)\n => syntaxTree.IsPreProcessorDirectiveContext(\n position, syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives: true), cancellationToken);\n\n public override bool IsEntirelyWithinStringOrCharOrNumericLiteral([NotNullWhen(true)] SyntaxTree? syntaxTree, int position, CancellationToken cancellationToken)\n {\n if (syntaxTree == null)\n {\n return false;\n }\n\n return syntaxTree.IsEntirelyWithinStringOrCharLiteral(position, cancellationToken);\n }\n\n public override bool IsDirective([NotNullWhen(true)] SyntaxNode? node)\n => node is DirectiveTriviaSyntax;\n\n public override bool TryGetExternalSourceInfo([NotNullWhen(true)] SyntaxNode? node, out ExternalSourceInfo info)\n {\n if (node is LineDirectiveTriviaSyntax lineDirective)\n {\n if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword)\n {\n info = new ExternalSourceInfo(null, ends: true);\n return true;\n }\n else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken &&\n lineDirective.Line.Value is int)\n {\n info = new ExternalSourceInfo((int)lineDirective.Line.Value, false);\n return true;\n }\n }\n\n info = default;\n return false;\n }\n\n public override bool IsNameOfSimpleMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n {\n var name = node as SimpleNameSyntax;\n return name.IsSimpleMemberAccessExpressionName();\n }\n\n public override bool IsNameOfAnyMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent is MemberAccessExpressionSyntax memberAccess && memberAccess.Name == node;\n\n public override bool IsNameOfMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node)\n {\n var name = node as SimpleNameSyntax;\n return name.IsMemberBindingExpressionName();\n }\n\n [return: NotNullIfNotNull(\"node\")]\n public override SyntaxNode? GetStandaloneExpression(SyntaxNode? node)\n => node is ExpressionSyntax expression ? SyntaxFactory.GetStandaloneExpression(expression) : node;\n\n public override SyntaxNode? GetRootConditionalAccessExpression(SyntaxNode? node)\n => node.GetRootConditionalAccessExpression();\n\n public override bool IsDeclarationExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is DeclarationExpressionSyntax;\n\n public override bool IsAttributeName(SyntaxNode node)\n => SyntaxFacts.IsAttributeName(node);\n\n public override bool IsNamedArgument([NotNullWhen(true)] SyntaxNode? node)\n => node is ArgumentSyntax arg && arg.NameColon != null;\n\n public override bool IsNameOfNamedArgument([NotNullWhen(true)] SyntaxNode? node)\n => node.CheckParent(p => p.Name == node);\n\n public override SyntaxToken? GetNameOfParameter(SyntaxNode? node)\n => (node as ParameterSyntax)?.Identifier;\n\n public override SyntaxNode? GetDefaultOfParameter(SyntaxNode node)\n => ((ParameterSyntax)node).Default;\n\n public override SyntaxNode? GetParameterList(SyntaxNode node)\n => node.GetParameterList();\n\n public override bool IsParameterList([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ParameterList, SyntaxKind.BracketedParameterList);\n\n public override SyntaxToken GetIdentifierOfGenericName(SyntaxNode node)\n => ((GenericNameSyntax)node).Identifier;\n\n public override bool IsUsingDirectiveName([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.UsingDirective, out UsingDirectiveSyntax? usingDirective) &&\n usingDirective.Name == node;\n\n public override bool IsUsingAliasDirective([NotNullWhen(true)] SyntaxNode? node)\n => node is UsingDirectiveSyntax usingDirectiveNode && usingDirectiveNode.Alias != null;\n\n public override void GetPartsOfUsingAliasDirective(SyntaxNode node, out SyntaxToken globalKeyword, out SyntaxToken alias, out SyntaxNode name)\n {\n var usingDirective = (UsingDirectiveSyntax)node;\n globalKeyword = usingDirective.GlobalKeyword;\n alias = usingDirective.Alias!.Name.Identifier;\n name = usingDirective.Name;\n }\n\n public override bool IsDeconstructionForEachStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is ForEachVariableStatementSyntax;\n\n public override bool IsDeconstructionAssignment([NotNullWhen(true)] SyntaxNode? node)\n => node is AssignmentExpressionSyntax assignment && assignment.IsDeconstruction();\n\n public override Location GetDeconstructionReferenceLocation(SyntaxNode node)\n {\n return node switch\n {\n AssignmentExpressionSyntax assignment => assignment.Left.GetLocation(),\n ForEachVariableStatementSyntax @foreach => @foreach.Variable.GetLocation(),\n _ => throw ExceptionUtilities.UnexpectedValue(node.Kind()),\n };\n }\n\n public override bool IsStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is StatementSyntax;\n\n public override bool IsExecutableStatement([NotNullWhen(true)] SyntaxNode? node)\n => node is StatementSyntax;\n\n public override bool IsMethodBody([NotNullWhen(true)] SyntaxNode? node)\n {\n if (node is BlockSyntax ||\n node is ArrowExpressionClauseSyntax)\n {\n return node.Parent is BaseMethodDeclarationSyntax ||\n node.Parent is AccessorDeclarationSyntax;\n }\n\n return false;\n }\n\n public override SyntaxNode? GetExpressionOfReturnStatement(SyntaxNode node)\n => ((ReturnStatementSyntax)node).Expression;\n\n public override bool IsThisConstructorInitializer(SyntaxToken token)\n => token.Parent.IsKind(SyntaxKind.ThisConstructorInitializer, out ConstructorInitializerSyntax? constructorInit) &&\n constructorInit.ThisOrBaseKeyword == token;\n\n public override bool IsBaseConstructorInitializer(SyntaxToken token)\n => token.Parent.IsKind(SyntaxKind.BaseConstructorInitializer, out ConstructorInitializerSyntax? constructorInit) &&\n constructorInit.ThisOrBaseKeyword == token;\n\n public override bool IsQueryKeyword(SyntaxToken token)\n {\n switch (token.Kind())\n {\n case SyntaxKind.FromKeyword:\n case SyntaxKind.JoinKeyword:\n case SyntaxKind.LetKeyword:\n case SyntaxKind.OrderByKeyword:\n case SyntaxKind.WhereKeyword:\n case SyntaxKind.OnKeyword:\n case SyntaxKind.EqualsKeyword:\n case SyntaxKind.InKeyword:\n return token.Parent is QueryClauseSyntax;\n case SyntaxKind.ByKeyword:\n case SyntaxKind.GroupKeyword:\n case SyntaxKind.SelectKeyword:\n return token.Parent is SelectOrGroupClauseSyntax;\n case SyntaxKind.AscendingKeyword:\n case SyntaxKind.DescendingKeyword:\n return token.Parent is OrderingSyntax;\n case SyntaxKind.IntoKeyword:\n return token.Parent.IsKind(SyntaxKind.JoinIntoClause, SyntaxKind.QueryContinuation);\n default:\n return false;\n }\n }\n\n public override bool IsPredefinedType(SyntaxToken token)\n => TryGetPredefinedType(token, out _);\n\n public override bool IsPredefinedType(SyntaxToken token, PredefinedType type)\n => TryGetPredefinedType(token, out var actualType) && actualType == type;\n\n public override bool TryGetPredefinedType(SyntaxToken token, out PredefinedType type)\n {\n type = GetPredefinedType(token);\n return type != PredefinedType.None;\n }\n\n private static PredefinedType GetPredefinedType(SyntaxToken token)\n {\n return (SyntaxKind)token.RawKind switch\n {\n SyntaxKind.BoolKeyword => PredefinedType.Boolean,\n SyntaxKind.ByteKeyword => PredefinedType.Byte,\n SyntaxKind.SByteKeyword => PredefinedType.SByte,\n SyntaxKind.IntKeyword => PredefinedType.Int32,\n SyntaxKind.UIntKeyword => PredefinedType.UInt32,\n SyntaxKind.ShortKeyword => PredefinedType.Int16,\n SyntaxKind.UShortKeyword => PredefinedType.UInt16,\n SyntaxKind.LongKeyword => PredefinedType.Int64,\n SyntaxKind.ULongKeyword => PredefinedType.UInt64,\n SyntaxKind.FloatKeyword => PredefinedType.Single,\n SyntaxKind.DoubleKeyword => PredefinedType.Double,\n SyntaxKind.DecimalKeyword => PredefinedType.Decimal,\n SyntaxKind.StringKeyword => PredefinedType.String,\n SyntaxKind.CharKeyword => PredefinedType.Char,\n SyntaxKind.ObjectKeyword => PredefinedType.Object,\n SyntaxKind.VoidKeyword => PredefinedType.Void,\n _ => PredefinedType.None,\n };\n }\n\n public override bool IsPredefinedOperator(SyntaxToken token)\n => TryGetPredefinedOperator(token, out var actualOperator) && actualOperator != PredefinedOperator.None;\n\n public override bool IsPredefinedOperator(SyntaxToken token, PredefinedOperator op)\n => TryGetPredefinedOperator(token, out var actualOperator) && actualOperator == op;\n\n public override bool TryGetPredefinedOperator(SyntaxToken token, out PredefinedOperator op)\n {\n op = GetPredefinedOperator(token);\n return op != PredefinedOperator.None;\n }\n\n private static PredefinedOperator GetPredefinedOperator(SyntaxToken token)\n {\n switch ((SyntaxKind)token.RawKind)\n {\n case SyntaxKind.PlusToken:\n case SyntaxKind.PlusEqualsToken:\n return PredefinedOperator.Addition;\n\n case SyntaxKind.MinusToken:\n case SyntaxKind.MinusEqualsToken:\n return PredefinedOperator.Subtraction;\n\n case SyntaxKind.AmpersandToken:\n case SyntaxKind.AmpersandEqualsToken:\n return PredefinedOperator.BitwiseAnd;\n\n case SyntaxKind.BarToken:\n case SyntaxKind.BarEqualsToken:\n return PredefinedOperator.BitwiseOr;\n\n case SyntaxKind.MinusMinusToken:\n return PredefinedOperator.Decrement;\n\n case SyntaxKind.PlusPlusToken:\n return PredefinedOperator.Increment;\n\n case SyntaxKind.SlashToken:\n case SyntaxKind.SlashEqualsToken:\n return PredefinedOperator.Division;\n\n case SyntaxKind.EqualsEqualsToken:\n return PredefinedOperator.Equality;\n\n case SyntaxKind.CaretToken:\n case SyntaxKind.CaretEqualsToken:\n return PredefinedOperator.ExclusiveOr;\n\n case SyntaxKind.GreaterThanToken:\n return PredefinedOperator.GreaterThan;\n\n case SyntaxKind.GreaterThanEqualsToken:\n return PredefinedOperator.GreaterThanOrEqual;\n\n case SyntaxKind.ExclamationEqualsToken:\n return PredefinedOperator.Inequality;\n\n case SyntaxKind.LessThanLessThanToken:\n case SyntaxKind.LessThanLessThanEqualsToken:\n return PredefinedOperator.LeftShift;\n\n case SyntaxKind.LessThanToken:\n return PredefinedOperator.LessThan;\n\n case SyntaxKind.LessThanEqualsToken:\n return PredefinedOperator.LessThanOrEqual;\n\n case SyntaxKind.AsteriskToken:\n case SyntaxKind.AsteriskEqualsToken:\n return PredefinedOperator.Multiplication;\n\n case SyntaxKind.PercentToken:\n case SyntaxKind.PercentEqualsToken:\n return PredefinedOperator.Modulus;\n\n case SyntaxKind.ExclamationToken:\n case SyntaxKind.TildeToken:\n return PredefinedOperator.Complement;\n\n case SyntaxKind.GreaterThanGreaterThanToken:\n case SyntaxKind.GreaterThanGreaterThanEqualsToken:\n return PredefinedOperator.RightShift;\n }\n\n return PredefinedOperator.None;\n }\n\n public override string GetText(int kind)\n => SyntaxFacts.GetText((SyntaxKind)kind);\n\n public override bool IsIdentifierStartCharacter(char c)\n => SyntaxFacts.IsIdentifierStartCharacter(c);\n\n public override bool IsIdentifierPartCharacter(char c)\n => SyntaxFacts.IsIdentifierPartCharacter(c);\n\n public override bool IsIdentifierEscapeCharacter(char c)\n => c == '@';\n\n public override bool IsValidIdentifier(string identifier)\n {\n var token = SyntaxFactory.ParseToken(identifier);\n return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length;\n }\n\n public override bool IsVerbatimIdentifier(string identifier)\n {\n var token = SyntaxFactory.ParseToken(identifier);\n return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();\n }\n\n public override bool IsTypeCharacter(char c) => false;\n\n public override bool IsStartOfUnicodeEscapeSequence(char c)\n => c == '\\\\';\n\n public override bool IsLiteral(SyntaxToken token)\n {\n switch (token.Kind())\n {\n case SyntaxKind.NumericLiteralToken:\n case SyntaxKind.CharacterLiteralToken:\n case SyntaxKind.StringLiteralToken:\n case SyntaxKind.NullKeyword:\n case SyntaxKind.TrueKeyword:\n case SyntaxKind.FalseKeyword:\n case SyntaxKind.InterpolatedStringStartToken:\n case SyntaxKind.InterpolatedStringEndToken:\n case SyntaxKind.InterpolatedVerbatimStringStartToken:\n case SyntaxKind.InterpolatedStringTextToken:\n return true;\n default:\n return false;\n }\n }\n\n public override bool IsStringLiteralOrInterpolatedStringLiteral(SyntaxToken token)\n => token.IsKind(SyntaxKind.StringLiteralToken, SyntaxKind.InterpolatedStringTextToken);\n\n public override bool IsBindableToken(SyntaxToken token)\n {\n if (this.IsWord(token) || this.IsLiteral(token) || this.IsOperator(token))\n {\n switch ((SyntaxKind)token.RawKind)\n {\n case SyntaxKind.DelegateKeyword:\n case SyntaxKind.VoidKeyword:\n return false;\n }\n\n return true;\n }\n\n // In the order by clause a comma might be bound to ThenBy or ThenByDescending\n if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause))\n {\n return true;\n }\n\n return false;\n }\n\n public override bool IsPostfixUnaryExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is PostfixUnaryExpressionSyntax;\n\n public override bool IsMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is MemberBindingExpressionSyntax;\n\n public override bool IsPointerMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression;\n\n public override void GetNameAndArityOfSimpleName(SyntaxNode node, out string name, out int arity)\n {\n var simpleName = (SimpleNameSyntax)node;\n name = simpleName.Identifier.ValueText;\n arity = simpleName.Arity;\n }\n\n public override bool LooksGeneric(SyntaxNode simpleName)\n => simpleName.IsKind(SyntaxKind.GenericName) ||\n simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken;\n\n public override SyntaxNode? GetTargetOfMemberBinding(SyntaxNode? node)\n => (node as MemberBindingExpressionSyntax).GetParentConditionalAccessExpression()?.Expression;\n\n public override SyntaxNode GetNameOfMemberBindingExpression(SyntaxNode node)\n => ((MemberBindingExpressionSyntax)node).Name;\n\n public override SyntaxNode? GetExpressionOfMemberAccessExpression(SyntaxNode node, bool allowImplicitTarget)\n => ((MemberAccessExpressionSyntax)node).Expression;\n\n public override void GetPartsOfElementAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode argumentList)\n {\n var elementAccess = (ElementAccessExpressionSyntax)node;\n expression = elementAccess.Expression;\n argumentList = elementAccess.ArgumentList;\n }\n\n public override SyntaxNode GetExpressionOfInterpolation(SyntaxNode node)\n => ((InterpolationSyntax)node).Expression;\n\n public override bool IsInStaticContext(SyntaxNode node)\n => node.IsInStaticContext();\n\n public override bool IsInNamespaceOrTypeContext([NotNullWhen(true)] SyntaxNode? node)\n => SyntaxFacts.IsInNamespaceOrTypeContext(node as ExpressionSyntax);\n\n public override bool IsBaseTypeList([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.BaseList);\n\n public override SyntaxNode GetExpressionOfArgument(SyntaxNode node)\n => ((ArgumentSyntax)node).Expression;\n\n public override RefKind GetRefKindOfArgument(SyntaxNode node)\n => ((ArgumentSyntax)node).GetRefKind();\n\n public override bool IsArgument([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Argument);\n\n public override bool IsSimpleArgument([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is ArgumentSyntax argument &&\n argument.RefOrOutKeyword.Kind() == SyntaxKind.None &&\n argument.NameColon == null;\n }\n\n public override bool IsInConstantContext([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsInConstantContext();\n\n public override bool IsInConstructor(SyntaxNode node)\n => node.GetAncestor() != null;\n\n public override bool IsUnsafeContext(SyntaxNode node)\n => node.IsUnsafeContext();\n\n public override SyntaxNode GetNameOfAttribute(SyntaxNode node)\n => ((AttributeSyntax)node).Name;\n\n public override bool IsAttributeNamedArgumentIdentifier([NotNullWhen(true)] SyntaxNode? node)\n => (node as IdentifierNameSyntax).IsAttributeNamedArgumentIdentifier();\n\n public override SyntaxNode? GetContainingTypeDeclaration(SyntaxNode? root, int position)\n {\n if (root == null)\n {\n throw new ArgumentNullException(nameof(root));\n }\n\n if (position < 0 || position > root.Span.End)\n {\n throw new ArgumentOutOfRangeException(nameof(position));\n }\n\n return root\n .FindToken(position)\n .GetAncestors()\n .FirstOrDefault(n => n is BaseTypeDeclarationSyntax || n is DelegateDeclarationSyntax);\n }\n\n public override SyntaxNode? GetContainingVariableDeclaratorOfFieldDeclaration(SyntaxNode? node)\n => throw ExceptionUtilities.Unreachable;\n\n public override bool IsNameOfSubpattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IdentifierName) &&\n node.IsParentKind(SyntaxKind.NameColon) &&\n node.Parent.IsParentKind(SyntaxKind.Subpattern);\n\n public override bool IsPropertyPatternClause(SyntaxNode node)\n => node.Kind() == SyntaxKind.PropertyPatternClause;\n\n public override bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node)\n => IsMemberInitializerNamedAssignmentIdentifier(node, out _);\n\n public override bool IsMemberInitializerNamedAssignmentIdentifier(\n [NotNullWhen(true)] SyntaxNode? node, [NotNullWhen(true)] out SyntaxNode? initializedInstance)\n {\n initializedInstance = null;\n if (node is IdentifierNameSyntax identifier &&\n identifier.IsLeftSideOfAssignExpression())\n {\n if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression))\n {\n var withInitializer = identifier.Parent.GetRequiredParent();\n initializedInstance = withInitializer.GetRequiredParent();\n return true;\n }\n else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression))\n {\n var objectInitializer = identifier.Parent.GetRequiredParent();\n if (objectInitializer.Parent is BaseObjectCreationExpressionSyntax)\n {\n initializedInstance = objectInitializer.Parent;\n return true;\n }\n else if (objectInitializer.IsParentKind(SyntaxKind.SimpleAssignmentExpression, out AssignmentExpressionSyntax? assignment))\n {\n initializedInstance = assignment.Left;\n return true;\n }\n }\n }\n\n return false;\n }\n\n public override bool IsElementAccessExpression(SyntaxNode? node)\n => node.IsKind(SyntaxKind.ElementAccessExpression);\n\n [return: NotNullIfNotNull(\"node\")]\n public override SyntaxNode? ConvertToSingleLine(SyntaxNode? node, bool useElasticTrivia = false)\n => node.ConvertToSingleLine(useElasticTrivia);\n\n public override bool IsIndexerMemberCRef(SyntaxNode? node)\n => node.IsKind(SyntaxKind.IndexerMemberCref);\n\n public override SyntaxNode? GetContainingMemberDeclaration(SyntaxNode? root, int position, bool useFullSpan = true)\n {\n Contract.ThrowIfNull(root, \"root\");\n Contract.ThrowIfTrue(position < 0 || position > root.FullSpan.End, \"position\");\n\n var end = root.FullSpan.End;\n if (end == 0)\n {\n // empty file\n return null;\n }\n\n // make sure position doesn't touch end of root\n position = Math.Min(position, end - 1);\n\n var node = root.FindToken(position).Parent;\n while (node != null)\n {\n if (useFullSpan || node.Span.Contains(position))\n {\n var kind = node.Kind();\n if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is MemberDeclarationSyntax))\n {\n return node;\n }\n }\n\n node = node.Parent;\n }\n\n return null;\n }\n\n public override bool IsMethodLevelMember([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is BaseMethodDeclarationSyntax ||\n node is BasePropertyDeclarationSyntax ||\n node is EnumMemberDeclarationSyntax ||\n node is BaseFieldDeclarationSyntax;\n }\n\n public override bool IsTopLevelNodeWithMembers([NotNullWhen(true)] SyntaxNode? node)\n {\n return node is BaseNamespaceDeclarationSyntax ||\n node is TypeDeclarationSyntax ||\n node is EnumDeclarationSyntax;\n }\n\n private const string dotToken = \".\";\n\n public override string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, string? rootNamespace = null)\n {\n if (node == null)\n {\n return string.Empty;\n }\n\n var pooled = PooledStringBuilder.GetInstance();\n var builder = pooled.Builder;\n\n // return type\n var memberDeclaration = node as MemberDeclarationSyntax;\n if ((options & DisplayNameOptions.IncludeType) != 0)\n {\n var type = memberDeclaration.GetMemberType();\n if (type != null && !type.IsMissing)\n {\n builder.Append(type);\n builder.Append(' ');\n }\n }\n\n var names = ArrayBuilder.GetInstance();\n // containing type(s)\n var parent = node.GetAncestor() ?? node.Parent;\n while (parent is TypeDeclarationSyntax)\n {\n names.Push(GetName(parent, options));\n parent = parent.Parent;\n }\n\n // containing namespace(s) in source (if any)\n if ((options & DisplayNameOptions.IncludeNamespaces) != 0)\n {\n while (parent is BaseNamespaceDeclarationSyntax)\n {\n names.Add(GetName(parent, options));\n parent = parent.Parent;\n }\n }\n\n while (!names.IsEmpty())\n {\n var name = names.Pop();\n if (name != null)\n {\n builder.Append(name);\n builder.Append(dotToken);\n }\n }\n\n // name (including generic type parameters)\n builder.Append(GetName(node, options));\n\n // parameter list (if any)\n if ((options & DisplayNameOptions.IncludeParameters) != 0)\n {\n builder.Append(memberDeclaration.GetParameterList());\n }\n\n return pooled.ToStringAndFree();\n }\n\n private static string? GetName(SyntaxNode node, DisplayNameOptions options)\n {\n const string missingTokenPlaceholder = \"?\";\n\n switch (node.Kind())\n {\n case SyntaxKind.CompilationUnit:\n return null;\n case SyntaxKind.IdentifierName:\n var identifier = ((IdentifierNameSyntax)node).Identifier;\n return identifier.IsMissing ? missingTokenPlaceholder : identifier.Text;\n case SyntaxKind.IncompleteMember:\n return missingTokenPlaceholder;\n case SyntaxKind.NamespaceDeclaration:\n case SyntaxKind.FileScopedNamespaceDeclaration:\n return GetName(((BaseNamespaceDeclarationSyntax)node).Name, options);\n case SyntaxKind.QualifiedName:\n var qualified = (QualifiedNameSyntax)node;\n return GetName(qualified.Left, options) + dotToken + GetName(qualified.Right, options);\n }\n\n string? name = null;\n if (node is MemberDeclarationSyntax memberDeclaration)\n {\n if (memberDeclaration.Kind() == SyntaxKind.ConversionOperatorDeclaration)\n {\n name = (memberDeclaration as ConversionOperatorDeclarationSyntax)?.Type.ToString();\n }\n else\n {\n var nameToken = memberDeclaration.GetNameToken();\n if (nameToken != default)\n {\n name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;\n if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration)\n {\n name = \"~\" + name;\n }\n\n if ((options & DisplayNameOptions.IncludeTypeParameters) != 0)\n {\n var pooled = PooledStringBuilder.GetInstance();\n var builder = pooled.Builder;\n builder.Append(name);\n AppendTypeParameterList(builder, memberDeclaration.GetTypeParameterList());\n name = pooled.ToStringAndFree();\n }\n }\n else\n {\n Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember);\n name = \"?\";\n }\n }\n }\n else\n {\n if (node is VariableDeclaratorSyntax fieldDeclarator)\n {\n var nameToken = fieldDeclarator.Identifier;\n if (nameToken != default)\n {\n name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;\n }\n }\n }\n\n Debug.Assert(name != null, \"Unexpected node type \" + node.Kind());\n return name;\n }\n\n private static void AppendTypeParameterList(StringBuilder builder, TypeParameterListSyntax typeParameterList)\n {\n if (typeParameterList != null && typeParameterList.Parameters.Count > 0)\n {\n builder.Append('<');\n builder.Append(typeParameterList.Parameters[0].Identifier.ValueText);\n for (var i = 1; i < typeParameterList.Parameters.Count; i++)\n {\n builder.Append(\", \");\n builder.Append(typeParameterList.Parameters[i].Identifier.ValueText);\n }\n\n builder.Append('>');\n }\n }\n\n public override List GetTopLevelAndMethodLevelMembers(SyntaxNode? root)\n {\n var list = new List();\n AppendMembers(root, list, topLevel: true, methodLevel: true);\n return list;\n }\n\n public override List GetMethodLevelMembers(SyntaxNode? root)\n {\n var list = new List();\n AppendMembers(root, list, topLevel: false, methodLevel: true);\n return list;\n }\n\n public override SyntaxList GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration)\n => ((TypeDeclarationSyntax)typeDeclaration).Members;\n\n private void AppendMembers(SyntaxNode? node, List list, bool topLevel, bool methodLevel)\n {\n Debug.Assert(topLevel || methodLevel);\n\n foreach (var member in node.GetMembers())\n {\n if (IsTopLevelNodeWithMembers(member))\n {\n if (topLevel)\n {\n list.Add(member);\n }\n\n AppendMembers(member, list, topLevel, methodLevel);\n continue;\n }\n\n if (methodLevel && IsMethodLevelMember(member))\n {\n list.Add(member);\n }\n }\n }\n\n public override TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node)\n {\n if (node.Span.IsEmpty)\n {\n return default;\n }\n\n var member = GetContainingMemberDeclaration(node, node.SpanStart);\n if (member == null)\n {\n return default;\n }\n\n // TODO: currently we only support method for now\n if (member is BaseMethodDeclarationSyntax method)\n {\n if (method.Body == null)\n {\n return default;\n }\n\n return GetBlockBodySpan(method.Body);\n }\n\n return default;\n }\n\n public override bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span)\n {\n switch (node)\n {\n case ConstructorDeclarationSyntax constructor:\n return (constructor.Body != null && GetBlockBodySpan(constructor.Body).Contains(span)) ||\n (constructor.Initializer != null && constructor.Initializer.Span.Contains(span));\n case BaseMethodDeclarationSyntax method:\n return method.Body != null && GetBlockBodySpan(method.Body).Contains(span);\n case BasePropertyDeclarationSyntax property:\n return property.AccessorList != null && property.AccessorList.Span.Contains(span);\n case EnumMemberDeclarationSyntax @enum:\n return @enum.EqualsValue != null && @enum.EqualsValue.Span.Contains(span);\n case BaseFieldDeclarationSyntax field:\n return field.Declaration != null && field.Declaration.Span.Contains(span);\n }\n\n return false;\n }\n\n private static TextSpan GetBlockBodySpan(BlockSyntax body)\n => TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart);\n\n public override SyntaxNode? TryGetBindableParent(SyntaxToken token)\n {\n var node = token.Parent;\n while (node != null)\n {\n var parent = node.Parent;\n\n // If this node is on the left side of a member access expression, don't ascend\n // further or we'll end up binding to something else.\n if (parent is MemberAccessExpressionSyntax memberAccess)\n {\n if (memberAccess.Expression == node)\n {\n break;\n }\n }\n\n // If this node is on the left side of a qualified name, don't ascend\n // further or we'll end up binding to something else.\n if (parent is QualifiedNameSyntax qualifiedName)\n {\n if (qualifiedName.Left == node)\n {\n break;\n }\n }\n\n // If this node is on the left side of a alias-qualified name, don't ascend\n // further or we'll end up binding to something else.\n if (parent is AliasQualifiedNameSyntax aliasQualifiedName)\n {\n if (aliasQualifiedName.Alias == node)\n {\n break;\n }\n }\n\n // If this node is the type of an object creation expression, return the\n // object creation expression.\n if (parent is ObjectCreationExpressionSyntax objectCreation)\n {\n if (objectCreation.Type == node)\n {\n node = parent;\n break;\n }\n }\n\n // The inside of an interpolated string is treated as its own token so we\n // need to force navigation to the parent expression syntax.\n if (node is InterpolatedStringTextSyntax && parent is InterpolatedStringExpressionSyntax)\n {\n node = parent;\n break;\n }\n\n // If this node is not parented by a name, we're done.\n if (!(parent is NameSyntax))\n {\n break;\n }\n\n node = parent;\n }\n\n if (node is VarPatternSyntax)\n {\n return node;\n }\n\n // Patterns are never bindable (though their constituent types/exprs may be).\n return node is PatternSyntax ? null : node;\n }\n\n public override IEnumerable GetConstructors(SyntaxNode? root, CancellationToken cancellationToken)\n {\n if (root is not CompilationUnitSyntax compilationUnit)\n {\n return SpecializedCollections.EmptyEnumerable();\n }\n\n var constructors = new List();\n AppendConstructors(compilationUnit.Members, constructors, cancellationToken);\n return constructors;\n }\n\n private void AppendConstructors(SyntaxList members, List constructors, CancellationToken cancellationToken)\n {\n foreach (var member in members)\n {\n cancellationToken.ThrowIfCancellationRequested();\n switch (member)\n {\n case ConstructorDeclarationSyntax constructor:\n constructors.Add(constructor);\n continue;\n case BaseNamespaceDeclarationSyntax @namespace:\n AppendConstructors(@namespace.Members, constructors, cancellationToken);\n break;\n case ClassDeclarationSyntax @class:\n AppendConstructors(@class.Members, constructors, cancellationToken);\n break;\n case RecordDeclarationSyntax record:\n AppendConstructors(record.Members, constructors, cancellationToken);\n break;\n case StructDeclarationSyntax @struct:\n AppendConstructors(@struct.Members, constructors, cancellationToken);\n break;\n }\n }\n }\n\n public override bool TryGetCorrespondingOpenBrace(SyntaxToken token, out SyntaxToken openBrace)\n {\n if (token.Kind() == SyntaxKind.CloseBraceToken)\n {\n var tuple = token.Parent.GetBraces();\n\n openBrace = tuple.openBrace;\n return openBrace.Kind() == SyntaxKind.OpenBraceToken;\n }\n\n openBrace = default;\n return false;\n }\n\n public override TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)\n {\n var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);\n if (trivia.Kind() == SyntaxKind.DisabledTextTrivia)\n {\n return trivia.FullSpan;\n }\n\n var token = syntaxTree.FindTokenOrEndToken(position, cancellationToken);\n if (token.Kind() == SyntaxKind.EndOfFileToken)\n {\n var triviaList = token.LeadingTrivia;\n foreach (var triviaTok in triviaList.Reverse())\n {\n if (triviaTok.Span.Contains(position))\n {\n return default;\n }\n\n if (triviaTok.Span.End < position)\n {\n if (!triviaTok.HasStructure)\n {\n return default;\n }\n\n var structure = triviaTok.GetStructure();\n if (structure is BranchingDirectiveTriviaSyntax branch)\n {\n return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default;\n }\n }\n }\n }\n\n return default;\n }\n\n public override string GetNameForArgument(SyntaxNode? argument)\n => (argument as ArgumentSyntax)?.NameColon?.Name.Identifier.ValueText ?? string.Empty;\n\n public override string GetNameForAttributeArgument(SyntaxNode? argument)\n => (argument as AttributeArgumentSyntax)?.NameEquals?.Name.Identifier.ValueText ?? string.Empty;\n\n public override bool IsLeftSideOfDot([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfDot();\n\n public override SyntaxNode? GetRightSideOfDot(SyntaxNode? node)\n {\n return (node as QualifiedNameSyntax)?.Right ??\n (node as MemberAccessExpressionSyntax)?.Name;\n }\n\n public override SyntaxNode? GetLeftSideOfDot(SyntaxNode? node, bool allowImplicitTarget)\n {\n return (node as QualifiedNameSyntax)?.Left ??\n (node as MemberAccessExpressionSyntax)?.Expression;\n }\n\n public override bool IsLeftSideOfExplicitInterfaceSpecifier([NotNullWhen(true)] SyntaxNode? node)\n => (node as NameSyntax).IsLeftSideOfExplicitInterfaceSpecifier();\n\n public override bool IsLeftSideOfAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfAssignExpression();\n\n public override bool IsLeftSideOfAnyAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfAnyAssignExpression();\n\n public override bool IsLeftSideOfCompoundAssignment([NotNullWhen(true)] SyntaxNode? node)\n => (node as ExpressionSyntax).IsLeftSideOfCompoundAssignExpression();\n\n public override SyntaxNode GetRightHandSideOfAssignment(SyntaxNode node)\n => ((AssignmentExpressionSyntax)node).Right;\n\n public override bool IsInferredAnonymousObjectMemberDeclarator([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.AnonymousObjectMemberDeclarator, out AnonymousObjectMemberDeclaratorSyntax? anonObject) &&\n anonObject.NameEquals == null;\n\n public override bool IsOperandOfIncrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.PostIncrementExpression) ||\n node.IsParentKind(SyntaxKind.PreIncrementExpression);\n\n public static bool IsOperandOfDecrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsParentKind(SyntaxKind.PostDecrementExpression) ||\n node.IsParentKind(SyntaxKind.PreDecrementExpression);\n\n public override bool IsOperandOfIncrementOrDecrementExpression([NotNullWhen(true)] SyntaxNode? node)\n => IsOperandOfIncrementExpression(node) || IsOperandOfDecrementExpression(node);\n\n public override SyntaxList GetContentsOfInterpolatedString(SyntaxNode interpolatedString)\n => ((InterpolatedStringExpressionSyntax)interpolatedString).Contents;\n\n public override bool IsVerbatimStringLiteral(SyntaxToken token)\n => token.IsVerbatimStringLiteral();\n\n public override bool IsNumericLiteral(SyntaxToken token)\n => token.Kind() == SyntaxKind.NumericLiteralToken;\n\n public override SeparatedSyntaxList GetArgumentsOfInvocationExpression(SyntaxNode invocationExpression)\n => GetArgumentsOfArgumentList(((InvocationExpressionSyntax)invocationExpression).ArgumentList);\n\n public override SeparatedSyntaxList GetArgumentsOfObjectCreationExpression(SyntaxNode objectCreationExpression)\n => ((BaseObjectCreationExpressionSyntax)objectCreationExpression).ArgumentList is { } argumentList\n ? GetArgumentsOfArgumentList(argumentList)\n : default;\n\n public override SeparatedSyntaxList GetArgumentsOfArgumentList(SyntaxNode argumentList)\n => ((BaseArgumentListSyntax)argumentList).Arguments;\n\n public override bool IsRegularComment(SyntaxTrivia trivia)\n => trivia.IsRegularComment();\n\n public override bool IsDocumentationComment(SyntaxTrivia trivia)\n => trivia.IsDocComment();\n\n public override bool IsElastic(SyntaxTrivia trivia)\n => trivia.IsElastic();\n\n public override bool IsPragmaDirective(SyntaxTrivia trivia, out bool isDisable, out bool isActive, out SeparatedSyntaxList errorCodes)\n => trivia.IsPragmaDirective(out isDisable, out isActive, out errorCodes);\n\n public override bool IsDocumentationCommentExteriorTrivia(SyntaxTrivia trivia)\n => trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia;\n\n public override bool IsDocumentationComment(SyntaxNode node)\n => SyntaxFacts.IsDocumentationCommentTrivia(node.Kind());\n\n public override bool IsUsingOrExternOrImport([NotNullWhen(true)] SyntaxNode? node)\n {\n return node.IsKind(SyntaxKind.UsingDirective) ||\n node.IsKind(SyntaxKind.ExternAliasDirective);\n }\n\n public override bool IsGlobalAssemblyAttribute([NotNullWhen(true)] SyntaxNode? node)\n => IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword);\n\n public override bool IsGlobalModuleAttribute([NotNullWhen(true)] SyntaxNode? node)\n => IsGlobalAttribute(node, SyntaxKind.ModuleKeyword);\n\n private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget)\n => node.IsKind(SyntaxKind.Attribute) &&\n node.Parent.IsKind(SyntaxKind.AttributeList, out AttributeListSyntax? attributeList) &&\n attributeList.Target?.Identifier.Kind() == attributeTarget;\n\n private static bool IsMemberDeclaration(SyntaxNode node)\n {\n // From the C# language spec:\n // class-member-declaration:\n // constant-declaration\n // field-declaration\n // method-declaration\n // property-declaration\n // event-declaration\n // indexer-declaration\n // operator-declaration\n // constructor-declaration\n // destructor-declaration\n // static-constructor-declaration\n // type-declaration\n switch (node.Kind())\n {\n // Because fields declarations can define multiple symbols \"public int a, b;\"\n // We want to get the VariableDeclarator node inside the field declaration to print out the symbol for the name.\n case SyntaxKind.VariableDeclarator:\n return node.Parent.IsParentKind(SyntaxKind.FieldDeclaration) ||\n node.Parent.IsParentKind(SyntaxKind.EventFieldDeclaration);\n\n case SyntaxKind.FieldDeclaration:\n case SyntaxKind.MethodDeclaration:\n case SyntaxKind.PropertyDeclaration:\n case SyntaxKind.GetAccessorDeclaration:\n case SyntaxKind.SetAccessorDeclaration:\n case SyntaxKind.EventDeclaration:\n case SyntaxKind.EventFieldDeclaration:\n case SyntaxKind.AddAccessorDeclaration:\n case SyntaxKind.RemoveAccessorDeclaration:\n case SyntaxKind.IndexerDeclaration:\n case SyntaxKind.OperatorDeclaration:\n case SyntaxKind.ConversionOperatorDeclaration:\n case SyntaxKind.ConstructorDeclaration:\n case SyntaxKind.DestructorDeclaration:\n return true;\n\n default:\n return false;\n }\n }\n\n public override bool IsDeclaration(SyntaxNode node)\n => SyntaxFacts.IsNamespaceMemberDeclaration(node.Kind()) || IsMemberDeclaration(node);\n\n public override bool IsTypeDeclaration(SyntaxNode node)\n => SyntaxFacts.IsTypeDeclaration(node.Kind());\n\n public override bool IsSimpleAssignmentStatement([NotNullWhen(true)] SyntaxNode? statement)\n => statement.IsKind(SyntaxKind.ExpressionStatement, out ExpressionStatementSyntax? exprStatement) &&\n exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);\n\n public override void GetPartsOfAssignmentStatement(\n SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n GetPartsOfAssignmentExpressionOrStatement(\n ((ExpressionStatementSyntax)statement).Expression, out left, out operatorToken, out right);\n }\n\n public override void GetPartsOfAssignmentExpressionOrStatement(\n SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var expression = statement;\n if (statement is ExpressionStatementSyntax expressionStatement)\n {\n expression = expressionStatement.Expression;\n }\n\n var assignment = (AssignmentExpressionSyntax)expression;\n left = assignment.Left;\n operatorToken = assignment.OperatorToken;\n right = assignment.Right;\n }\n\n public override SyntaxToken GetIdentifierOfSimpleName(SyntaxNode node)\n => ((SimpleNameSyntax)node).Identifier;\n\n public override SyntaxToken GetIdentifierOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclaratorSyntax)node).Identifier;\n\n public override SyntaxToken GetIdentifierOfParameter(SyntaxNode node)\n => ((ParameterSyntax)node).Identifier;\n\n public override SyntaxToken GetIdentifierOfTypeDeclaration(SyntaxNode node)\n => node switch\n {\n BaseTypeDeclarationSyntax typeDecl => typeDecl.Identifier,\n DelegateDeclarationSyntax delegateDecl => delegateDecl.Identifier,\n _ => throw ExceptionUtilities.UnexpectedValue(node),\n };\n\n public override SyntaxToken GetIdentifierOfIdentifierName(SyntaxNode node)\n => ((IdentifierNameSyntax)node).Identifier;\n\n public override bool IsDeclaratorOfLocalDeclarationStatement(SyntaxNode declarator, SyntaxNode localDeclarationStatement)\n {\n return ((LocalDeclarationStatementSyntax)localDeclarationStatement).Declaration.Variables.Contains(\n (VariableDeclaratorSyntax)declarator);\n }\n\n public override bool AreEquivalent(SyntaxToken token1, SyntaxToken token2)\n => SyntaxFactory.AreEquivalent(token1, token2);\n\n public override bool AreEquivalent(SyntaxNode? node1, SyntaxNode? node2)\n => SyntaxFactory.AreEquivalent(node1, node2);\n\n public static SyntaxNode GetExpressionOfInvocationExpression(SyntaxNode node)\n => ((InvocationExpressionSyntax)node).Expression;\n\n public override bool IsExpressionOfForeach([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent is ForEachStatementSyntax foreachStatement && foreachStatement.Expression == node;\n\n public override SyntaxNode GetExpressionOfExpressionStatement(SyntaxNode node)\n => ((ExpressionStatementSyntax)node).Expression;\n\n public override bool IsIsExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IsExpression);\n\n [return: NotNullIfNotNull(\"node\")]\n public override SyntaxNode? WalkDownParentheses(SyntaxNode? node)\n => (node as ExpressionSyntax)?.WalkDownParentheses() ?? node;\n\n public override void GetPartsOfTupleExpression(SyntaxNode node,\n out SyntaxToken openParen, out SeparatedSyntaxList arguments, out SyntaxToken closeParen)\n {\n var tupleExpression = (TupleExpressionSyntax)node;\n openParen = tupleExpression.OpenParenToken;\n arguments = (SeparatedSyntaxList)tupleExpression.Arguments;\n closeParen = tupleExpression.CloseParenToken;\n }\n\n public override bool IsPreprocessorDirective(SyntaxTrivia trivia)\n => SyntaxFacts.IsPreprocessorDirective(trivia.Kind());\n\n public override bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)\n => token.ContainsInterleavedDirective(span, cancellationToken);\n\n public override SyntaxTokenList GetModifiers(SyntaxNode? node)\n => node.GetModifiers();\n\n public override SyntaxNode? WithModifiers(SyntaxNode? node, SyntaxTokenList modifiers)\n => node.WithModifiers(modifiers);\n\n public override SeparatedSyntaxList GetVariablesOfLocalDeclarationStatement(SyntaxNode node)\n => ((LocalDeclarationStatementSyntax)node).Declaration.Variables;\n\n public override SyntaxNode? GetInitializerOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclaratorSyntax)node).Initializer;\n\n public override SyntaxNode GetTypeOfVariableDeclarator(SyntaxNode node)\n => ((VariableDeclarationSyntax)((VariableDeclaratorSyntax)node).Parent!).Type;\n\n public override SyntaxNode? GetValueOfEqualsValueClause(SyntaxNode? node)\n => ((EqualsValueClauseSyntax?)node)?.Value;\n\n public override bool IsScopeBlock([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Block);\n\n public override bool IsExecutableBlock([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.Block, SyntaxKind.SwitchSection, SyntaxKind.CompilationUnit);\n\n public override IReadOnlyList GetExecutableBlockStatements(SyntaxNode? node)\n {\n return node switch\n {\n BlockSyntax block => block.Statements,\n SwitchSectionSyntax switchSection => switchSection.Statements,\n CompilationUnitSyntax compilationUnit => compilationUnit.Members.OfType().SelectAsArray(globalStatement => globalStatement.Statement),\n _ => throw ExceptionUtilities.UnexpectedValue(node),\n };\n }\n\n public override SyntaxNode? FindInnermostCommonExecutableBlock(IEnumerable nodes)\n => nodes.FindInnermostCommonNode(node => IsExecutableBlock(node));\n\n public override bool IsStatementContainer([NotNullWhen(true)] SyntaxNode? node)\n => IsExecutableBlock(node) || node.IsEmbeddedStatementOwner();\n\n public override IReadOnlyList GetStatementContainerStatements(SyntaxNode? node)\n {\n if (IsExecutableBlock(node))\n return GetExecutableBlockStatements(node);\n else if (node.GetEmbeddedStatement() is { } embeddedStatement)\n return ImmutableArray.Create(embeddedStatement);\n else\n return ImmutableArray.Empty;\n }\n\n public override bool IsConversionExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is CastExpressionSyntax;\n\n public override bool IsCastExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is CastExpressionSyntax;\n\n public override void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode expression)\n {\n var cast = (CastExpressionSyntax)node;\n type = cast.Type;\n expression = cast.Expression;\n }\n\n public override SyntaxToken? GetDeclarationIdentifierIfOverride(SyntaxToken token)\n {\n if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member)\n {\n return member.GetNameToken();\n }\n\n return null;\n }\n\n public override SyntaxList GetAttributeLists(SyntaxNode? node)\n => node.GetAttributeLists();\n\n public override bool IsParameterNameXmlElementSyntax([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.XmlElement, out XmlElementSyntax? xmlElement) &&\n xmlElement.StartTag.Name.LocalName.ValueText == DocumentationCommentXmlNames.ParameterElementName;\n\n public override SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia)\n {\n if (trivia.GetStructure() is DocumentationCommentTriviaSyntax documentationCommentTrivia)\n {\n return documentationCommentTrivia.Content;\n }\n\n throw ExceptionUtilities.UnexpectedValue(trivia.Kind());\n }\n\n public override bool IsIsPatternExpression([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.IsPatternExpression);\n\n public override void GetPartsOfIsPatternExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken isToken, out SyntaxNode right)\n {\n var isPatternExpression = (IsPatternExpressionSyntax)node;\n left = isPatternExpression.Expression;\n isToken = isPatternExpression.IsKeyword;\n right = isPatternExpression.Pattern;\n }\n\n public override bool IsAnyPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is PatternSyntax;\n\n public override bool IsConstantPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ConstantPattern);\n\n public override bool IsDeclarationPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.DeclarationPattern);\n\n public override bool IsRecursivePattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.RecursivePattern);\n\n public override bool IsVarPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.VarPattern);\n\n public override SyntaxNode GetExpressionOfConstantPattern(SyntaxNode node)\n => ((ConstantPatternSyntax)node).Expression;\n\n public override void GetPartsOfDeclarationPattern(SyntaxNode node, out SyntaxNode type, out SyntaxNode designation)\n {\n var declarationPattern = (DeclarationPatternSyntax)node;\n type = declarationPattern.Type;\n designation = declarationPattern.Designation;\n }\n\n public override void GetPartsOfRecursivePattern(SyntaxNode node, out SyntaxNode? type, out SyntaxNode? positionalPart, out SyntaxNode? propertyPart, out SyntaxNode? designation)\n {\n var recursivePattern = (RecursivePatternSyntax)node;\n type = recursivePattern.Type;\n positionalPart = recursivePattern.PositionalPatternClause;\n propertyPart = recursivePattern.PropertyPatternClause;\n designation = recursivePattern.Designation;\n }\n\n public override bool SupportsNotPattern(ParseOptions options)\n => ((CSharpParseOptions)options).LanguageVersion.IsCSharp9OrAbove();\n\n public override bool IsAndPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.AndPattern);\n\n public override bool IsBinaryPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is BinaryPatternSyntax;\n\n public override bool IsNotPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.NotPattern);\n\n public override bool IsOrPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.OrPattern);\n\n public override bool IsParenthesizedPattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.ParenthesizedPattern);\n\n public override bool IsTypePattern([NotNullWhen(true)] SyntaxNode? node)\n => node.IsKind(SyntaxKind.TypePattern);\n\n public override bool IsUnaryPattern([NotNullWhen(true)] SyntaxNode? node)\n => node is UnaryPatternSyntax;\n\n public override void GetPartsOfParenthesizedPattern(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode pattern, out SyntaxToken closeParen)\n {\n var parenthesizedPattern = (ParenthesizedPatternSyntax)node;\n openParen = parenthesizedPattern.OpenParenToken;\n pattern = parenthesizedPattern.Pattern;\n closeParen = parenthesizedPattern.CloseParenToken;\n }\n\n public override void GetPartsOfBinaryPattern(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var binaryPattern = (BinaryPatternSyntax)node;\n left = binaryPattern.Left;\n operatorToken = binaryPattern.OperatorToken;\n right = binaryPattern.Right;\n }\n\n public override void GetPartsOfUnaryPattern(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode pattern)\n {\n var unaryPattern = (UnaryPatternSyntax)node;\n operatorToken = unaryPattern.OperatorToken;\n pattern = unaryPattern.Pattern;\n }\n\n public override SyntaxNode GetTypeOfTypePattern(SyntaxNode node)\n => ((TypePatternSyntax)node).Type;\n\n public override void GetPartsOfInterpolationExpression(SyntaxNode node,\n out SyntaxToken stringStartToken, out SyntaxList contents, out SyntaxToken stringEndToken)\n {\n var interpolatedStringExpression = (InterpolatedStringExpressionSyntax)node;\n stringStartToken = interpolatedStringExpression.StringStartToken;\n contents = interpolatedStringExpression.Contents;\n stringEndToken = interpolatedStringExpression.StringEndToken;\n }\n\n public override bool IsVerbatimInterpolatedStringExpression(SyntaxNode node)\n => node is InterpolatedStringExpressionSyntax interpolatedString &&\n interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken);\n\n #region IsXXX members\n\n public override bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is AnonymousFunctionExpressionSyntax;\n\n public override bool IsBaseNamespaceDeclaration([NotNullWhen(true)] SyntaxNode? node)\n => node is BaseNamespaceDeclarationSyntax;\n\n public override bool IsBinaryExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is BinaryExpressionSyntax;\n\n public override bool IsLiteralExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is LiteralExpressionSyntax;\n\n public override bool IsMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node)\n => node is MemberAccessExpressionSyntax;\n\n public override bool IsSimpleName([NotNullWhen(true)] SyntaxNode? node)\n => node is SimpleNameSyntax;\n\n #endregion\n\n #region GetPartsOfXXX members\n\n public override void GetPartsOfBinaryExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var binaryExpression = (BinaryExpressionSyntax)node;\n left = binaryExpression.Left;\n operatorToken = binaryExpression.OperatorToken;\n right = binaryExpression.Right;\n }\n\n public override void GetPartsOfCompilationUnit(SyntaxNode node, out SyntaxList imports, out SyntaxList attributeLists, out SyntaxList members)\n {\n var compilationUnit = (CompilationUnitSyntax)node;\n imports = compilationUnit.Usings;\n attributeLists = compilationUnit.AttributeLists;\n members = compilationUnit.Members;\n }\n\n public override void GetPartsOfConditionalAccessExpression(\n SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode whenNotNull)\n {\n var conditionalAccess = (ConditionalAccessExpressionSyntax)node;\n expression = conditionalAccess.Expression;\n operatorToken = conditionalAccess.OperatorToken;\n whenNotNull = conditionalAccess.WhenNotNull;\n }\n\n public override void GetPartsOfConditionalExpression(SyntaxNode node, out SyntaxNode condition, out SyntaxNode whenTrue, out SyntaxNode whenFalse)\n {\n var conditionalExpression = (ConditionalExpressionSyntax)node;\n condition = conditionalExpression.Condition;\n whenTrue = conditionalExpression.WhenTrue;\n whenFalse = conditionalExpression.WhenFalse;\n }\n\n public override void GetPartsOfInvocationExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode? argumentList)\n {\n var invocation = (InvocationExpressionSyntax)node;\n expression = invocation.Expression;\n argumentList = invocation.ArgumentList;\n }\n\n public override void GetPartsOfMemberAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode name)\n {\n var memberAccess = (MemberAccessExpressionSyntax)node;\n expression = memberAccess.Expression;\n operatorToken = memberAccess.OperatorToken;\n name = memberAccess.Name;\n }\n\n public override void GetPartsOfBaseNamespaceDeclaration(SyntaxNode node, out SyntaxNode name, out SyntaxList imports, out SyntaxList members)\n {\n var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)node;\n name = namespaceDeclaration.Name;\n imports = namespaceDeclaration.Usings;\n members = namespaceDeclaration.Members;\n }\n\n public override void GetPartsOfObjectCreationExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode? argumentList, out SyntaxNode? initializer)\n {\n var objectCreationExpression = (ObjectCreationExpressionSyntax)node;\n type = objectCreationExpression.Type;\n argumentList = objectCreationExpression.ArgumentList;\n initializer = objectCreationExpression.Initializer;\n }\n\n public override void GetPartsOfParenthesizedExpression(\n SyntaxNode node, out SyntaxToken openParen, out SyntaxNode expression, out SyntaxToken closeParen)\n {\n var parenthesizedExpression = (ParenthesizedExpressionSyntax)node;\n openParen = parenthesizedExpression.OpenParenToken;\n expression = parenthesizedExpression.Expression;\n closeParen = parenthesizedExpression.CloseParenToken;\n }\n\n public override void GetPartsOfPrefixUnaryExpression(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode operand)\n {\n var prefixUnaryExpression = (PrefixUnaryExpressionSyntax)node;\n operatorToken = prefixUnaryExpression.OperatorToken;\n operand = prefixUnaryExpression.Operand;\n }\n\n public override void GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right)\n {\n var qualifiedName = (QualifiedNameSyntax)node;\n left = qualifiedName.Left;\n operatorToken = qualifiedName.DotToken;\n right = qualifiedName.Right;\n }\n\n #endregion\n\n #region GetXXXOfYYY members\n\n public override SyntaxNode GetExpressionOfAwaitExpression(SyntaxNode node)\n => ((AwaitExpressionSyntax)node).Expression;\n\n public override SyntaxNode GetExpressionOfThrowExpression(SyntaxNode node)\n => ((ThrowExpressionSyntax)node).Expression;\n\n #endregion\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":208,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/AbstractSyntaxFacts.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n internal abstract class AbstractSyntaxFacts\n {\n public abstract ISyntaxKinds SyntaxKinds { get; }\n\n protected AbstractSyntaxFacts()\n {\n }\n\n public bool IsSingleLineCommentTrivia(SyntaxTrivia trivia)\n => SyntaxKinds.SingleLineCommentTrivia == trivia.RawKind;\n\n public bool IsMultiLineCommentTrivia(SyntaxTrivia trivia)\n => SyntaxKinds.MultiLineCommentTrivia == trivia.RawKind;\n\n public bool IsSingleLineDocCommentTrivia(SyntaxTrivia trivia)\n => SyntaxKinds.SingleLineDocCommentTrivia == trivia.RawKind;\n\n public bool IsMultiLineDocCommentTrivia(SyntaxTrivia trivia)\n => SyntaxKinds.MultiLineDocCommentTrivia == trivia.RawKind;\n\n public bool IsShebangDirectiveTrivia(SyntaxTrivia trivia)\n => SyntaxKinds.ShebangDirectiveTrivia == trivia.RawKind;\n\n public abstract bool IsPreprocessorDirective(SyntaxTrivia trivia);\n\n public abstract bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);\n\n public abstract SyntaxList GetAttributeLists(SyntaxNode node);\n\n public abstract bool IsParameterNameXmlElementSyntax(SyntaxNode node);\n\n public abstract SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia);\n\n public bool HasIncompleteParentMember([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent?.RawKind == SyntaxKinds.IncompleteMember;\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n internal abstract class AbstractSyntaxFacts : ISyntaxFacts\n {\n public abstract ISyntaxKinds SyntaxKinds { get; }\n\n protected AbstractSyntaxFacts()\n {\n }\n\n public abstract bool IsPreprocessorDirective(SyntaxTrivia trivia);\n\n public abstract bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);\n\n public abstract SyntaxList GetAttributeLists(SyntaxNode? node);\n\n public abstract bool IsParameterNameXmlElementSyntax(SyntaxNode? node);\n\n public abstract SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia);\n\n public bool HasIncompleteParentMember([NotNullWhen(true)] SyntaxNode? node)\n => node?.Parent?.RawKind == SyntaxKinds.IncompleteMember;\n\n public abstract bool AreEquivalent(SyntaxNode? node1, SyntaxNode? node2);\n public abstract bool AreEquivalent(SyntaxToken token1, SyntaxToken token2);\n public abstract bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span);\n public abstract bool IsAndPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsAnyPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsArgument([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsAttributeName(SyntaxNode node);\n public abstract bool IsAttributeNamedArgumentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsBaseConstructorInitializer(SyntaxToken token);\n public abstract bool IsBaseNamespaceDeclaration([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsBaseTypeList([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsBinaryExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsBinaryPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsBindableToken(SyntaxToken token);\n public abstract bool IsCaseSensitive { get; }\n public abstract bool IsCastExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsConstantPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsContextualKeyword(SyntaxToken token);\n public abstract bool IsConversionExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDeclaration(SyntaxNode node);\n public abstract bool IsDeclarationExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDeclarationPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDeclaratorOfLocalDeclarationStatement(SyntaxNode declarator, SyntaxNode localDeclarationStatement);\n public abstract bool IsDeconstructionAssignment([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDeconstructionForEachStatement([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDirective([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsDocumentationComment(SyntaxNode node);\n public abstract bool IsDocumentationComment(SyntaxTrivia trivia);\n public abstract bool IsDocumentationCommentExteriorTrivia(SyntaxTrivia trivia);\n public abstract bool IsElastic(SyntaxTrivia trivia);\n public abstract bool IsElementAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsEntirelyWithinStringOrCharOrNumericLiteral([NotNullWhen(true)] SyntaxTree? syntaxTree, int position, CancellationToken cancellationToken);\n public abstract bool IsExecutableBlock([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsExecutableStatement([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsExpressionOfForeach([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsGlobalAssemblyAttribute([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsGlobalModuleAttribute([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsIdentifierEscapeCharacter(char c);\n public abstract bool IsIdentifierPartCharacter(char c);\n public abstract bool IsIdentifierStartCharacter(char c);\n public abstract bool IsInConstantContext([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsInConstructor(SyntaxNode node);\n public abstract bool IsIndexerMemberCRef([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsInferredAnonymousObjectMemberDeclarator([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsInNamespaceOrTypeContext([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsInStaticContext(SyntaxNode node);\n public abstract bool IsIsExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsIsPatternExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLeftSideOfAnyAssignment([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLeftSideOfAssignment([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLeftSideOfCompoundAssignment([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLeftSideOfDot([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLeftSideOfExplicitInterfaceSpecifier([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsLiteral(SyntaxToken token);\n public abstract bool IsLiteralExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node, [NotNullWhen(true)] out SyntaxNode? initializedInstance);\n public abstract bool IsMethodBody([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsMethodLevelMember([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNameOfAnyMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNameOfMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNameOfNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNameOfSimpleMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNameOfSubpattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNotPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsNumericLiteral(SyntaxToken token);\n public abstract bool IsOperandOfIncrementExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsOperandOfIncrementOrDecrementExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsOperator(SyntaxToken token);\n public abstract bool IsOrPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsParameterList([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsParenthesizedPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsPointerMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsPostfixUnaryExpression([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsPragmaDirective(SyntaxTrivia trivia, out bool isDisable, out bool isActive, out SeparatedSyntaxList errorCodes);\n public abstract bool IsPredefinedOperator(SyntaxToken token);\n public abstract bool IsPredefinedOperator(SyntaxToken token, PredefinedOperator op);\n public abstract bool IsPredefinedType(SyntaxToken token);\n public abstract bool IsPredefinedType(SyntaxToken token, PredefinedType type);\n public abstract bool IsPreProcessorDirectiveContext(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);\n public abstract bool IsPreprocessorKeyword(SyntaxToken token);\n public abstract bool IsPropertyPatternClause(SyntaxNode node);\n public abstract bool IsQueryKeyword(SyntaxToken token);\n public abstract bool IsRecursivePattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsRegularComment(SyntaxTrivia trivia);\n public abstract bool IsReservedKeyword(SyntaxToken token);\n public abstract bool IsScopeBlock([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsSimpleArgument([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsSimpleAssignmentStatement([NotNullWhen(true)] SyntaxNode? statement);\n public abstract bool IsSimpleName([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsStartOfUnicodeEscapeSequence(char c);\n public abstract bool IsStatement([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsStatementContainer([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsStringLiteralOrInterpolatedStringLiteral(SyntaxToken token);\n public abstract bool IsThisConstructorInitializer(SyntaxToken token);\n public abstract bool IsTopLevelNodeWithMembers([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsTypeCharacter(char c);\n public abstract bool IsTypeDeclaration(SyntaxNode node);\n public abstract bool IsTypePattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsUnaryPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsUnsafeContext(SyntaxNode node);\n public abstract bool IsUsingAliasDirective([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsUsingDirectiveName([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsUsingOrExternOrImport([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsValidIdentifier(string identifier);\n public abstract bool IsVarPattern([NotNullWhen(true)] SyntaxNode? node);\n public abstract bool IsVerbatimIdentifier(string identifier);\n public abstract bool IsVerbatimIdentifier(SyntaxToken token);\n public abstract bool IsVerbatimInterpolatedStringExpression(SyntaxNode node);\n public abstract bool IsVerbatimStringLiteral(SyntaxToken token);\n public abstract bool LooksGeneric(SyntaxNode simpleName);\n public abstract bool SupportsIndexingInitializer(ParseOptions options);\n public abstract bool SupportsLocalFunctionDeclaration(ParseOptions options);\n public abstract bool SupportsNotPattern(ParseOptions options);\n public abstract bool SupportsRecord(ParseOptions options);\n public abstract bool SupportsRecordStruct(ParseOptions options);\n public abstract bool SupportsThrowExpression(ParseOptions options);\n public abstract bool TryGetCorrespondingOpenBrace(SyntaxToken token, out SyntaxToken openBrace);\n public abstract bool TryGetExternalSourceInfo([NotNullWhen(true)] SyntaxNode? directive, out ExternalSourceInfo info);\n public abstract bool TryGetPredefinedOperator(SyntaxToken token, out PredefinedOperator op);\n public abstract bool TryGetPredefinedType(SyntaxToken token, out PredefinedType type);\n public abstract IEnumerable GetConstructors(SyntaxNode? root, CancellationToken cancellationToken);\n public abstract IReadOnlyList GetExecutableBlockStatements(SyntaxNode? node);\n public abstract IReadOnlyList GetStatementContainerStatements(SyntaxNode? node);\n public abstract List GetMethodLevelMembers(SyntaxNode? root);\n public abstract List GetTopLevelAndMethodLevelMembers(SyntaxNode? root);\n public abstract Location GetDeconstructionReferenceLocation(SyntaxNode node);\n public abstract RefKind GetRefKindOfArgument(SyntaxNode node);\n public abstract SeparatedSyntaxList GetArgumentsOfArgumentList(SyntaxNode node);\n public abstract SeparatedSyntaxList GetArgumentsOfInvocationExpression(SyntaxNode node);\n public abstract SeparatedSyntaxList GetArgumentsOfObjectCreationExpression(SyntaxNode node);\n public abstract SeparatedSyntaxList GetVariablesOfLocalDeclarationStatement(SyntaxNode node);\n public abstract string EscapeIdentifier(string identifier);\n public abstract string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, string? rootNamespace = null);\n public abstract string GetNameForArgument(SyntaxNode? argument);\n public abstract string GetNameForAttributeArgument(SyntaxNode? argument);\n public abstract string GetText(int kind);\n public abstract StringComparer StringComparer { get; }\n public abstract SyntaxList GetContentsOfInterpolatedString(SyntaxNode interpolatedString);\n public abstract SyntaxList GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration);\n public abstract SyntaxNode GetExpressionOfArgument(SyntaxNode node);\n public abstract SyntaxNode GetExpressionOfAwaitExpression(SyntaxNode node);\n public abstract SyntaxNode GetExpressionOfConstantPattern(SyntaxNode node);\n public abstract SyntaxNode GetExpressionOfExpressionStatement(SyntaxNode node);\n public abstract SyntaxNode GetExpressionOfInterpolation(SyntaxNode node);\n public abstract SyntaxNode GetExpressionOfThrowExpression(SyntaxNode node);\n public abstract SyntaxNode GetNameOfAttribute(SyntaxNode node);\n public abstract SyntaxNode GetNameOfMemberBindingExpression(SyntaxNode node);\n public abstract SyntaxNode GetRightHandSideOfAssignment(SyntaxNode node);\n public abstract SyntaxNode GetTypeOfTypePattern(SyntaxNode node);\n public abstract SyntaxNode GetTypeOfVariableDeclarator(SyntaxNode node);\n public abstract SyntaxNode? FindInnermostCommonExecutableBlock(IEnumerable nodes);\n public abstract SyntaxNode? GetContainingMemberDeclaration(SyntaxNode? root, int position, bool useFullSpan = true);\n public abstract SyntaxNode? GetContainingTypeDeclaration(SyntaxNode? root, int position);\n public abstract SyntaxNode? GetContainingVariableDeclaratorOfFieldDeclaration(SyntaxNode? node);\n public abstract SyntaxNode? GetDefaultOfParameter(SyntaxNode node);\n public abstract SyntaxNode? GetExpressionOfMemberAccessExpression(SyntaxNode node, bool allowImplicitTarget = false);\n public abstract SyntaxNode? GetExpressionOfReturnStatement(SyntaxNode node);\n public abstract SyntaxNode? GetInitializerOfVariableDeclarator(SyntaxNode node);\n public abstract SyntaxNode? GetLeftSideOfDot(SyntaxNode? node, bool allowImplicitTarget = false);\n public abstract SyntaxNode? GetParameterList(SyntaxNode node);\n public abstract SyntaxNode? GetRightSideOfDot(SyntaxNode? node);\n public abstract SyntaxNode? GetRootConditionalAccessExpression(SyntaxNode? node);\n public abstract SyntaxNode? GetTargetOfMemberBinding(SyntaxNode? node);\n public abstract SyntaxNode? GetValueOfEqualsValueClause(SyntaxNode? node);\n public abstract SyntaxNode? TryGetBindableParent(SyntaxToken token);\n public abstract SyntaxToken GetIdentifierOfGenericName(SyntaxNode node);\n public abstract SyntaxToken GetIdentifierOfIdentifierName(SyntaxNode node);\n public abstract SyntaxToken GetIdentifierOfParameter(SyntaxNode node);\n public abstract SyntaxToken GetIdentifierOfSimpleName(SyntaxNode node);\n public abstract SyntaxToken GetIdentifierOfTypeDeclaration(SyntaxNode node);\n public abstract SyntaxToken GetIdentifierOfVariableDeclarator(SyntaxNode node);\n public abstract SyntaxToken ParseToken(string text);\n public abstract SyntaxToken? GetDeclarationIdentifierIfOverride(SyntaxToken token);\n public abstract SyntaxToken? GetNameOfParameter([NotNullWhen(true)] SyntaxNode? node);\n public abstract SyntaxTokenList GetModifiers(SyntaxNode? node);\n public abstract SyntaxTrivia ElasticCarriageReturnLineFeed { get; }\n public abstract SyntaxTrivia ElasticMarker { get; }\n public abstract SyntaxTriviaList ParseLeadingTrivia(string text);\n public abstract TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken);\n public abstract TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node);\n public abstract void GetNameAndArityOfSimpleName(SyntaxNode node, out string name, out int arity);\n public abstract void GetPartsOfAssignmentExpressionOrStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n public abstract void GetPartsOfAssignmentStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n public abstract void GetPartsOfBaseNamespaceDeclaration(SyntaxNode node, out SyntaxNode name, out SyntaxList imports, out SyntaxList members);\n public abstract void GetPartsOfBinaryExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n public abstract void GetPartsOfBinaryPattern(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n public abstract void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode expression);\n public abstract void GetPartsOfCompilationUnit(SyntaxNode node, out SyntaxList imports, out SyntaxList attributeLists, out SyntaxList members);\n public abstract void GetPartsOfConditionalAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode whenNotNull);\n public abstract void GetPartsOfConditionalExpression(SyntaxNode node, out SyntaxNode condition, out SyntaxNode whenTrue, out SyntaxNode whenFalse);\n public abstract void GetPartsOfDeclarationPattern(SyntaxNode node, out SyntaxNode type, out SyntaxNode designation);\n public abstract void GetPartsOfElementAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode argumentList);\n public abstract void GetPartsOfInterpolationExpression(SyntaxNode node, out SyntaxToken stringStartToken, out SyntaxList contents, out SyntaxToken stringEndToken);\n public abstract void GetPartsOfInvocationExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode? argumentList);\n public abstract void GetPartsOfIsPatternExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken isToken, out SyntaxNode right);\n public abstract void GetPartsOfMemberAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode name);\n public abstract void GetPartsOfObjectCreationExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode? argumentList, out SyntaxNode? initializer);\n public abstract void GetPartsOfParenthesizedExpression(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode expression, out SyntaxToken closeParen);\n public abstract void GetPartsOfParenthesizedPattern(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode pattern, out SyntaxToken closeParen);\n public abstract void GetPartsOfPrefixUnaryExpression(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode operand);\n public abstract void GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken dotToken, out SyntaxNode right);\n public abstract void GetPartsOfRecursivePattern(SyntaxNode node, out SyntaxNode? type, out SyntaxNode? positionalPart, out SyntaxNode? propertyPart, out SyntaxNode? designation);\n public abstract void GetPartsOfTupleExpression(SyntaxNode node, out SyntaxToken openParen, out SeparatedSyntaxList arguments, out SyntaxToken closeParen) where TArgumentSyntax : SyntaxNode;\n public abstract void GetPartsOfUnaryPattern(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode pattern);\n public abstract void GetPartsOfUsingAliasDirective(SyntaxNode node, out SyntaxToken globalKeyword, out SyntaxToken alias, out SyntaxNode name);\n\n [return: NotNullIfNotNull(\"node\")]\n public abstract SyntaxNode? GetStandaloneExpression(SyntaxNode? node);\n [return: NotNullIfNotNull(\"node\")]\n public abstract SyntaxNode? WalkDownParentheses(SyntaxNode? node);\n [return: NotNullIfNotNull(\"node\")]\n public abstract SyntaxNode? ConvertToSingleLine(SyntaxNode? node, bool useElasticTrivia = false);\n [return: NotNullIfNotNull(\"node\")]\n public abstract SyntaxNode? WithModifiers(SyntaxNode? node, SyntaxTokenList modifiers);\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":209,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.Text;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n /// \n /// Contains helpers to allow features and other algorithms to run over C# and Visual Basic code in a uniform fashion.\n /// It should be thought of a generalized way to apply type-pattern-matching and syntax-deconstruction in a uniform\n /// fashion over the languages. Helpers in this type should only be one of the following forms:\n /// \n /// \n /// 'IsXXX' where 'XXX' exactly matches one of the same named syntax (node, token, trivia, list, etc.) constructs that \n /// both C# and VB have. For example 'IsSimpleName' to correspond to C# and VB's SimpleNameSyntax node. These 'checking' \n /// methods should never fail. For non leaf node types this should be implemented as a typecheck ('is' in C#, 'typeof ... is'\n /// in VB). For leaf nodes, this should be implemented by deffering to to check against the \n /// raw kind of the node.\n /// \n /// \n /// 'GetPartsOfXXX(SyntaxNode node, out SyntaxNode/SyntaxToken part1, ...)' where 'XXX' one of the same named Syntax constructs\n /// that both C# and VB have, and where the returned parts correspond to the members those nodes have in common across the \n /// languages. For example 'GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken dotToken, out SyntaxNode right)'\n /// VB. These functions should throw if passed a node that the corresponding 'IsXXX' did not return for.\n /// For nodes that only have a single child, 'GetPartsOfXXX' is not not needed and can be replaced with the easier to use\n /// 'GetXXXOfYYY' to get that single child.\n /// \n /// \n /// 'GetXxxOfYYY' where 'XXX' matches the name of a property on a 'YYY' syntax construct that both C# and VB have. For\n /// example 'GetExpressionOfMemberAccessExpression' corresponding to MemberAccessExpressionsyntax.Expression in both C# and\n /// VB. These functions should throw if passed a node that the corresponding 'IsYYY' did not return for.\n /// For nodes that only have a single child, these functions can stay here. For nodes with multiple children, these should migrate\n /// to and be built off of 'GetPartsOfXXX'.\n /// \n /// \n /// Absolutely trivial questions that relate to syntax and can be asked sensibly of each language. For example,\n /// if certain constructs (like 'patterns') are supported in that language or not.\n /// \n /// \n ///\n /// Importantly, avoid:\n ///\n /// \n /// \n /// Functions that attempt to blur the lines between similar constructs in the same language. For example, a QualifiedName\n /// is not the same as a MemberAccessExpression (despite A.B being representable as either depending on context). \n /// Features that need to handle both should make it clear that they are doing so, showing that they're doing the right\n /// thing for the contexts each can arise in (for the above example in 'type' vs 'expression' contexts).\n /// \n /// \n /// Functions which are effectively specific to a single feature are are just trying to find a place to place complex\n /// feature logic in a place such that it can run over VB or C#. For example, a function to determine if a position\n /// is on the 'header' of a node. a 'header' is a not a well defined syntax concept that can be trivially asked of\n /// nodes in either language. It is an excapsulation of a feature (or set of features) level idea that should be in\n /// its own dedicated service.\n /// \n /// \n /// Functions that mutate or update syntax constructs for example 'WithXXX'. These should be on SyntaxGenerator or\n /// some other feature specific service.\n /// \n /// \n /// Functions that a single item when one language may allow for multiple. For example 'GetIdentifierOfVariableDeclarator'.\n /// In VB a VariableDeclarator can itself have several names, so calling code must be written to check for that and handle\n /// it apropriately. Functions like this make it seem like that doesn't need to be considered, easily allowing for bugs\n /// to creep in.\n /// \n /// \n /// Abbreviating or otherwise changing the names that C# and VB share here. For example use 'ObjectCreationExpression'\n /// not 'ObjectCreation'. This prevents accidental duplication and keeps consistency with all members.\n /// \n /// \n /// \n /// \n /// Many helpers in this type currently violate the above 'dos' and 'do nots'. They should be removed and either \n /// inlined directly into the feature that needs if (if only a single feature), or moved into a dedicated service\n /// for that purpose if needed by multiple features.\n /// \n internal interface ISyntaxFacts\n {\n bool IsCaseSensitive { get; }\n StringComparer StringComparer { get; }\n\n SyntaxTrivia ElasticMarker { get; }\n SyntaxTrivia ElasticCarriageReturnLineFeed { get; }\n\n ISyntaxKinds SyntaxKinds { get; }\n\n bool SupportsIndexingInitializer(ParseOptions options);\n bool SupportsLocalFunctionDeclaration(ParseOptions options);\n bool SupportsNotPattern(ParseOptions options);\n bool SupportsRecord(ParseOptions options);\n bool SupportsRecordStruct(ParseOptions options);\n bool SupportsThrowExpression(ParseOptions options);\n\n SyntaxToken ParseToken(string text);\n SyntaxTriviaList ParseLeadingTrivia(string text);\n string EscapeIdentifier(string identifier);\n bool IsVerbatimIdentifier(SyntaxToken token);\n bool IsOperator(SyntaxToken token);\n bool IsPredefinedType(SyntaxToken token);\n bool IsPredefinedType(SyntaxToken token, PredefinedType type);\n bool IsPredefinedOperator(SyntaxToken token);\n bool IsPredefinedOperator(SyntaxToken token, PredefinedOperator op);\n\n /// \n /// Returns 'true' if this a 'reserved' keyword for the language. A 'reserved' keyword is a\n /// identifier that is always treated as being a special keyword, regardless of where it is\n /// found in the token stream. Examples of this are tokens like and\n /// in C# and VB respectively.\n ///\n /// Importantly, this does *not* include contextual keywords. If contextual keywords are\n /// important for your scenario, use or . Also, consider using\n /// if all you need is the ability to know\n /// if this is effectively any identifier in the language, regardless of whether the language\n /// is treating it as a keyword or not.\n /// \n bool IsReservedKeyword(SyntaxToken token);\n\n /// \n /// Returns if this a 'contextual' keyword for the language. A\n /// 'contextual' keyword is a identifier that is only treated as being a special keyword in\n /// certain *syntactic* contexts. Examples of this is 'yield' in C#. This is only a\n /// keyword if used as 'yield return' or 'yield break'. Importantly, identifiers like , and are *not*\n /// 'contextual' keywords. This is because they are not treated as keywords depending on\n /// the syntactic context around them. Instead, the language always treats them identifiers\n /// that have special *semantic* meaning if they end up not binding to an existing symbol.\n ///\n /// Importantly, if is not in the syntactic construct where the\n /// language thinks an identifier should be contextually treated as a keyword, then this\n /// will return .\n ///\n /// Or, in other words, the parser must be able to identify these cases in order to be a\n /// contextual keyword. If identification happens afterwards, it's not contextual.\n /// \n bool IsContextualKeyword(SyntaxToken token);\n\n /// \n /// The set of identifiers that have special meaning directly after the `#` token in a\n /// preprocessor directive. For example `if` or `pragma`.\n /// \n bool IsPreprocessorKeyword(SyntaxToken token);\n bool IsPreProcessorDirectiveContext(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);\n\n bool IsLiteral(SyntaxToken token);\n bool IsStringLiteralOrInterpolatedStringLiteral(SyntaxToken token);\n\n bool IsNumericLiteral(SyntaxToken token);\n bool IsVerbatimStringLiteral(SyntaxToken token);\n\n bool IsUsingOrExternOrImport([NotNullWhen(true)] SyntaxNode? node);\n bool IsGlobalAssemblyAttribute([NotNullWhen(true)] SyntaxNode? node);\n bool IsGlobalModuleAttribute([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeclaration(SyntaxNode node);\n bool IsTypeDeclaration(SyntaxNode node);\n\n bool IsUsingAliasDirective([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsRegularComment(SyntaxTrivia trivia);\n bool IsDocumentationComment(SyntaxTrivia trivia);\n bool IsElastic(SyntaxTrivia trivia);\n bool IsPragmaDirective(SyntaxTrivia trivia, out bool isDisable, out bool isActive, out SeparatedSyntaxList errorCodes);\n\n bool IsSingleLineCommentTrivia(SyntaxTrivia trivia);\n bool IsMultiLineCommentTrivia(SyntaxTrivia trivia);\n bool IsSingleLineDocCommentTrivia(SyntaxTrivia trivia);\n bool IsMultiLineDocCommentTrivia(SyntaxTrivia trivia);\n bool IsShebangDirectiveTrivia(SyntaxTrivia trivia);\n bool IsPreprocessorDirective(SyntaxTrivia trivia);\n\n bool IsDocumentationComment(SyntaxNode node);\n\n string GetText(int kind);\n bool IsEntirelyWithinStringOrCharOrNumericLiteral([NotNullWhen(true)] SyntaxTree? syntaxTree, int position, CancellationToken cancellationToken);\n\n bool TryGetPredefinedType(SyntaxToken token, out PredefinedType type);\n bool TryGetPredefinedOperator(SyntaxToken token, out PredefinedOperator op);\n bool TryGetExternalSourceInfo([NotNullWhen(true)] SyntaxNode? directive, out ExternalSourceInfo info);\n\n bool IsDeclarationExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsIsExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsIsPatternExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsConversionExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsCastExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsExpressionOfForeach([NotNullWhen(true)] SyntaxNode? node);\n\n void GetPartsOfTupleExpression(SyntaxNode node,\n out SyntaxToken openParen, out SeparatedSyntaxList arguments, out SyntaxToken closeParen) where TArgumentSyntax : SyntaxNode;\n\n void GetPartsOfInterpolationExpression(SyntaxNode node,\n out SyntaxToken stringStartToken, out SyntaxList contents, out SyntaxToken stringEndToken);\n\n bool IsVerbatimInterpolatedStringExpression(SyntaxNode node);\n\n // Left side of = assignment.\n bool IsLeftSideOfAssignment([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsSimpleAssignmentStatement([NotNullWhen(true)] SyntaxNode? statement);\n void GetPartsOfAssignmentStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfAssignmentExpressionOrStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n\n // Left side of any assignment (for example = or ??= or *= or += )\n bool IsLeftSideOfAnyAssignment([NotNullWhen(true)] SyntaxNode? node);\n // Left side of compound assignment (for example ??= or *= or += )\n bool IsLeftSideOfCompoundAssignment([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode GetRightHandSideOfAssignment(SyntaxNode node);\n\n bool IsInferredAnonymousObjectMemberDeclarator([NotNullWhen(true)] SyntaxNode? node);\n bool IsOperandOfIncrementExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsOperandOfIncrementOrDecrementExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsLeftSideOfDot([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode? GetRightSideOfDot(SyntaxNode? node);\n\n /// \n /// Get the node on the left side of the dot if given a dotted expression.\n /// \n /// \n /// In VB, we have a member access expression with a null expression, this may be one of the\n /// following forms:\n /// 1) new With { .a = 1, .b = .a .a refers to the anonymous type\n /// 2) With obj : .m .m refers to the obj type\n /// 3) new T() With { .a = 1, .b = .a 'a refers to the T type\n /// If `allowImplicitTarget` is set to true, the returned node will be set to approperiate node, otherwise, it will return null.\n /// This parameter has no affect on C# node.\n /// \n SyntaxNode? GetLeftSideOfDot(SyntaxNode? node, bool allowImplicitTarget = false);\n\n bool IsLeftSideOfExplicitInterfaceSpecifier([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsNameOfSimpleMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfAnyMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// Gets the containing expression that is actually a language expression and not just typed\n /// as an ExpressionSyntax for convenience. For example, NameSyntax nodes on the right side\n /// of qualified names and member access expressions are not language expressions, yet the\n /// containing qualified names or member access expressions are indeed expressions.\n /// \n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? GetStandaloneExpression(SyntaxNode? node);\n\n /// \n /// Call on the `.y` part of a `x?.y` to get the entire `x?.y` conditional access expression. This also works\n /// when there are multiple chained conditional accesses. For example, calling this on '.y' or '.z' in\n /// `x?.y?.z` will both return the full `x?.y?.z` node. This can be used to effectively get 'out' of the RHS of\n /// a conditional access, and commonly represents the full standalone expression that can be operated on\n /// atomically.\n /// \n SyntaxNode? GetRootConditionalAccessExpression(SyntaxNode? node);\n\n /// \n /// Returns the expression node the member is being accessed off of. If \n /// is , this will be the node directly to the left of the dot-token. If \n /// is , then this can return another node in the tree that the member will be accessed\n /// off of. For example, in VB, if you have a member-access-expression of the form \".Length\" then this\n /// may return the expression in the surrounding With-statement.\n /// \n SyntaxNode? GetExpressionOfMemberAccessExpression(SyntaxNode node, bool allowImplicitTarget = false);\n\n SyntaxNode? GetTargetOfMemberBinding(SyntaxNode? node);\n\n SyntaxNode GetNameOfMemberBindingExpression(SyntaxNode node);\n\n bool IsPointerMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n SyntaxToken? GetNameOfParameter([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode? GetDefaultOfParameter(SyntaxNode node);\n SyntaxNode? GetParameterList(SyntaxNode node);\n bool IsParameterList([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDocumentationCommentExteriorTrivia(SyntaxTrivia trivia);\n\n void GetPartsOfElementAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode argumentList);\n\n SyntaxNode GetExpressionOfArgument(SyntaxNode node);\n SyntaxNode GetExpressionOfInterpolation(SyntaxNode node);\n SyntaxNode GetNameOfAttribute(SyntaxNode node);\n\n bool IsMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsPostfixUnaryExpression([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxToken GetIdentifierOfGenericName(SyntaxNode node);\n SyntaxToken GetIdentifierOfSimpleName(SyntaxNode node);\n SyntaxToken GetIdentifierOfParameter(SyntaxNode node);\n SyntaxToken GetIdentifierOfTypeDeclaration(SyntaxNode node);\n SyntaxToken GetIdentifierOfVariableDeclarator(SyntaxNode node);\n SyntaxToken GetIdentifierOfIdentifierName(SyntaxNode node);\n SyntaxNode GetTypeOfVariableDeclarator(SyntaxNode node);\n\n /// \n /// True if this is an argument with just an expression and nothing else (i.e. no ref/out,\n /// no named params, no omitted args).\n /// \n bool IsSimpleArgument([NotNullWhen(true)] SyntaxNode? node);\n bool IsArgument([NotNullWhen(true)] SyntaxNode? node);\n RefKind GetRefKindOfArgument(SyntaxNode node);\n\n void GetNameAndArityOfSimpleName(SyntaxNode node, out string name, out int arity);\n bool LooksGeneric(SyntaxNode simpleName);\n\n SyntaxList GetContentsOfInterpolatedString(SyntaxNode interpolatedString);\n\n SeparatedSyntaxList GetArgumentsOfInvocationExpression(SyntaxNode node);\n SeparatedSyntaxList GetArgumentsOfObjectCreationExpression(SyntaxNode node);\n SeparatedSyntaxList GetArgumentsOfArgumentList(SyntaxNode node);\n\n bool IsUsingDirectiveName([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsAttributeName(SyntaxNode node);\n // Violation. Doesn't correspond to any shared structure for vb/c#\n SyntaxList GetAttributeLists(SyntaxNode? node);\n\n bool IsAttributeNamedArgumentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node, [NotNullWhen(true)] out SyntaxNode? initializedInstance);\n\n bool IsDirective([NotNullWhen(true)] SyntaxNode? node);\n bool IsStatement([NotNullWhen(true)] SyntaxNode? node);\n bool IsExecutableStatement([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDeconstructionAssignment([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeconstructionForEachStatement([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// Returns true for nodes that represent the body of a method.\n ///\n /// For VB this will be\n /// MethodBlockBaseSyntax. This will be true for things like constructor, method, operator\n /// bodies as well as accessor bodies. It will not be true for things like sub() function()\n /// lambdas.\n ///\n /// For C# this will be the BlockSyntax or ArrowExpressionSyntax for a\n /// method/constructor/deconstructor/operator/accessor. It will not be included for local\n /// functions.\n /// \n bool IsMethodBody([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDeclaratorOfLocalDeclarationStatement(SyntaxNode declarator, SyntaxNode localDeclarationStatement);\n SeparatedSyntaxList GetVariablesOfLocalDeclarationStatement(SyntaxNode node);\n SyntaxNode? GetInitializerOfVariableDeclarator(SyntaxNode node);\n\n bool IsThisConstructorInitializer(SyntaxToken token);\n bool IsBaseConstructorInitializer(SyntaxToken token);\n bool IsQueryKeyword(SyntaxToken token);\n bool IsElementAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsIndexerMemberCRef([NotNullWhen(true)] SyntaxNode? node);\n bool IsIdentifierStartCharacter(char c);\n bool IsIdentifierPartCharacter(char c);\n bool IsIdentifierEscapeCharacter(char c);\n bool IsStartOfUnicodeEscapeSequence(char c);\n\n bool IsValidIdentifier(string identifier);\n bool IsVerbatimIdentifier(string identifier);\n\n /// \n /// Returns true if the given character is a character which may be included in an\n /// identifier to specify the type of a variable.\n /// \n bool IsTypeCharacter(char c);\n\n // Violation. This is a feature level API for QuickInfo.\n bool IsBindableToken(SyntaxToken token);\n\n bool IsInStaticContext(SyntaxNode node);\n bool IsUnsafeContext(SyntaxNode node);\n\n bool IsInNamespaceOrTypeContext([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsBaseTypeList([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsInConstantContext([NotNullWhen(true)] SyntaxNode? node);\n bool IsInConstructor(SyntaxNode node);\n bool IsMethodLevelMember([NotNullWhen(true)] SyntaxNode? node);\n bool IsTopLevelNodeWithMembers([NotNullWhen(true)] SyntaxNode? node);\n bool HasIncompleteParentMember([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// A block that has no semantics other than introducing a new scope. That is only C# BlockSyntax.\n /// \n bool IsScopeBlock([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// A node that contains a list of statements. In C#, this is BlockSyntax and SwitchSectionSyntax.\n /// In VB, this includes all block statements such as a MultiLineIfBlockSyntax.\n /// \n bool IsExecutableBlock([NotNullWhen(true)] SyntaxNode? node);\n // Violation. This should return a SyntaxList\n IReadOnlyList GetExecutableBlockStatements(SyntaxNode? node);\n // Violation. This is a feature level API.\n SyntaxNode? FindInnermostCommonExecutableBlock(IEnumerable nodes);\n\n /// \n /// A node that can host a list of statements or a single statement. In addition to\n /// every \"executable block\", this also includes C# embedded statement owners.\n /// \n // Violation. This is a feature level API.\n bool IsStatementContainer([NotNullWhen(true)] SyntaxNode? node);\n\n // Violation. This is a feature level API.\n IReadOnlyList GetStatementContainerStatements(SyntaxNode? node);\n\n bool AreEquivalent(SyntaxToken token1, SyntaxToken token2);\n bool AreEquivalent(SyntaxNode? node1, SyntaxNode? node2);\n\n string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, string? rootNamespace = null);\n\n // Violation. This is a feature level API. How 'position' relates to 'containment' is not defined.\n SyntaxNode? GetContainingTypeDeclaration(SyntaxNode? root, int position);\n SyntaxNode? GetContainingMemberDeclaration(SyntaxNode? root, int position, bool useFullSpan = true);\n SyntaxNode? GetContainingVariableDeclaratorOfFieldDeclaration(SyntaxNode? node);\n\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? WalkDownParentheses(SyntaxNode? node);\n\n // Violation. This is a feature level API.\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? ConvertToSingleLine(SyntaxNode? node, bool useElasticTrivia = false);\n\n // Violation. This is a feature level API.\n List GetTopLevelAndMethodLevelMembers(SyntaxNode? root);\n // Violation. This is a feature level API.\n List GetMethodLevelMembers(SyntaxNode? root);\n SyntaxList GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration);\n\n // Violation. This is a feature level API.\n bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span);\n // Violation. This is a feature level API.\n TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken);\n\n /// \n /// Given a , return the representing the span of the member body\n /// it is contained within. This is used to determine whether speculative binding should be\n /// used in performance-critical typing scenarios. Note: if this method fails to find a relevant span, it returns\n /// an empty at position 0.\n /// \n // Violation. This is a feature level API.\n TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node);\n\n /// \n /// Returns the parent node that binds to the symbols that the IDE prefers for features like Quick Info and Find\n /// All References. For example, if the token is part of the type of an object creation, the parenting object\n /// creation expression is returned so that binding will return constructor symbols.\n /// \n // Violation. This is a feature level API.\n SyntaxNode? TryGetBindableParent(SyntaxToken token);\n\n // Violation. This is a feature level API.\n IEnumerable GetConstructors(SyntaxNode? root, CancellationToken cancellationToken);\n // Violation. This is a feature level API.\n bool TryGetCorrespondingOpenBrace(SyntaxToken token, out SyntaxToken openBrace);\n\n /// \n /// Given a , that represents and argument return the string representation of\n /// that arguments name.\n /// \n // Violation. This is a feature level API.\n string GetNameForArgument(SyntaxNode? argument);\n\n /// \n /// Given a , that represents an attribute argument return the string representation of\n /// that arguments name.\n /// \n // Violation. This is a feature level API.\n string GetNameForAttributeArgument(SyntaxNode? argument);\n\n bool IsNameOfSubpattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsPropertyPatternClause(SyntaxNode node);\n\n bool IsAnyPattern([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsAndPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsBinaryPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsConstantPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeclarationPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsNotPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsOrPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsParenthesizedPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsRecursivePattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsTypePattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsUnaryPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsVarPattern([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxNode GetExpressionOfConstantPattern(SyntaxNode node);\n SyntaxNode GetTypeOfTypePattern(SyntaxNode node);\n\n void GetPartsOfParenthesizedPattern(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode pattern, out SyntaxToken closeParen);\n void GetPartsOfBinaryPattern(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfDeclarationPattern(SyntaxNode node, out SyntaxNode type, out SyntaxNode designation);\n void GetPartsOfRecursivePattern(SyntaxNode node, out SyntaxNode? type, out SyntaxNode? positionalPart, out SyntaxNode? propertyPart, out SyntaxNode? designation);\n void GetPartsOfUnaryPattern(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode pattern);\n\n bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);\n\n SyntaxTokenList GetModifiers(SyntaxNode? node);\n\n // Violation. WithXXX methods should not be here, but should be in SyntaxGenerator.\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? WithModifiers(SyntaxNode? node, SyntaxTokenList modifiers);\n\n // Violation. This is a feature level API.\n Location GetDeconstructionReferenceLocation(SyntaxNode node);\n\n // Violation. This is a feature level API.\n SyntaxToken? GetDeclarationIdentifierIfOverride(SyntaxToken token);\n\n bool IsParameterNameXmlElementSyntax([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia);\n\n #region IsXXX members\n\n bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsBaseNamespaceDeclaration([NotNullWhen(true)] SyntaxNode? node);\n bool IsBinaryExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsLiteralExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsSimpleName([NotNullWhen(true)] SyntaxNode? node);\n\n #endregion\n\n #region GetPartsOfXXX members\n\n void GetPartsOfBaseNamespaceDeclaration(SyntaxNode node, out SyntaxNode name, out SyntaxList imports, out SyntaxList members);\n void GetPartsOfBinaryExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode expression);\n void GetPartsOfCompilationUnit(SyntaxNode node, out SyntaxList imports, out SyntaxList attributeLists, out SyntaxList members);\n void GetPartsOfConditionalAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode whenNotNull);\n void GetPartsOfConditionalExpression(SyntaxNode node, out SyntaxNode condition, out SyntaxNode whenTrue, out SyntaxNode whenFalse);\n void GetPartsOfInvocationExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode? argumentList);\n void GetPartsOfIsPatternExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken isToken, out SyntaxNode right);\n void GetPartsOfMemberAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode name);\n void GetPartsOfObjectCreationExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode? argumentList, out SyntaxNode? initializer);\n void GetPartsOfParenthesizedExpression(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode expression, out SyntaxToken closeParen);\n void GetPartsOfPrefixUnaryExpression(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode operand);\n void GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken dotToken, out SyntaxNode right);\n void GetPartsOfUsingAliasDirective(SyntaxNode node, out SyntaxToken globalKeyword, out SyntaxToken alias, out SyntaxNode name);\n\n #endregion\n\n #region GetXXXOfYYYMembers\n\n // note: this is only for nodes that have a single child nodes. If a node has multiple child nodes, then\n // ISyntaxFacts should have a GetPartsOfXXX helper instead, and GetXXXOfYYY should be built off of that\n // inside ISyntaxFactsExtensions\n\n SyntaxNode GetExpressionOfAwaitExpression(SyntaxNode node);\n SyntaxNode GetExpressionOfExpressionStatement(SyntaxNode node);\n SyntaxNode? GetExpressionOfReturnStatement(SyntaxNode node);\n SyntaxNode GetExpressionOfThrowExpression(SyntaxNode node);\n SyntaxNode? GetValueOfEqualsValueClause(SyntaxNode? node);\n\n #endregion\n }\n\n [Flags]\n internal enum DisplayNameOptions\n {\n None = 0,\n IncludeMemberKeyword = 1,\n IncludeNamespaces = 1 << 1,\n IncludeParameters = 1 << 2,\n IncludeType = 1 << 3,\n IncludeTypeParameters = 1 << 4\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.Text;\n\n#if CODE_STYLE\nusing Microsoft.CodeAnalysis.Internal.Editing;\n#else\nusing Microsoft.CodeAnalysis.Editing;\n#endif\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n /// \n /// Contains helpers to allow features and other algorithms to run over C# and Visual Basic code in a uniform fashion.\n /// It should be thought of a generalized way to apply type-pattern-matching and syntax-deconstruction in a uniform\n /// fashion over the languages. Helpers in this type should only be one of the following forms:\n /// \n /// \n /// 'IsXXX' where 'XXX' exactly matches one of the same named syntax (node, token, trivia, list, etc.) constructs that \n /// both C# and VB have. For example 'IsSimpleName' to correspond to C# and VB's SimpleNameSyntax node. These 'checking' \n /// methods should never fail. For non leaf node types this should be implemented as a typecheck ('is' in C#, 'typeof ... is'\n /// in VB). For leaf nodes, this should be implemented by deffering to to check against the \n /// raw kind of the node.\n /// \n /// \n /// 'GetPartsOfXXX(SyntaxNode node, out SyntaxNode/SyntaxToken part1, ...)' where 'XXX' one of the same named Syntax constructs\n /// that both C# and VB have, and where the returned parts correspond to the members those nodes have in common across the \n /// languages. For example 'GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken dotToken, out SyntaxNode right)'\n /// VB. These functions should throw if passed a node that the corresponding 'IsXXX' did not return for.\n /// For nodes that only have a single child, 'GetPartsOfXXX' is not not needed and can be replaced with the easier to use\n /// 'GetXXXOfYYY' to get that single child.\n /// \n /// \n /// 'GetXxxOfYYY' where 'XXX' matches the name of a property on a 'YYY' syntax construct that both C# and VB have. For\n /// example 'GetExpressionOfMemberAccessExpression' corresponding to MemberAccessExpressionsyntax.Expression in both C# and\n /// VB. These functions should throw if passed a node that the corresponding 'IsYYY' did not return for.\n /// For nodes that only have a single child, these functions can stay here. For nodes with multiple children, these should migrate\n /// to and be built off of 'GetPartsOfXXX'.\n /// \n /// \n /// Absolutely trivial questions that relate to syntax and can be asked sensibly of each language. For example,\n /// if certain constructs (like 'patterns') are supported in that language or not.\n /// \n /// \n ///\n /// Importantly, avoid:\n ///\n /// \n /// \n /// Functions that attempt to blur the lines between similar constructs in the same language. For example, a QualifiedName\n /// is not the same as a MemberAccessExpression (despite A.B being representable as either depending on context). \n /// Features that need to handle both should make it clear that they are doing so, showing that they're doing the right\n /// thing for the contexts each can arise in (for the above example in 'type' vs 'expression' contexts).\n /// \n /// \n /// Functions which are effectively specific to a single feature are are just trying to find a place to place complex\n /// feature logic in a place such that it can run over VB or C#. For example, a function to determine if a position\n /// is on the 'header' of a node. a 'header' is a not a well defined syntax concept that can be trivially asked of\n /// nodes in either language. It is an excapsulation of a feature (or set of features) level idea that should be in\n /// its own dedicated service.\n /// \n /// \n /// Functions that mutate or update syntax constructs for example 'WithXXX'. These should be on SyntaxGenerator or\n /// some other feature specific service.\n /// \n /// \n /// Functions that a single item when one language may allow for multiple. For example 'GetIdentifierOfVariableDeclarator'.\n /// In VB a VariableDeclarator can itself have several names, so calling code must be written to check for that and handle\n /// it apropriately. Functions like this make it seem like that doesn't need to be considered, easily allowing for bugs\n /// to creep in.\n /// \n /// \n /// Abbreviating or otherwise changing the names that C# and VB share here. For example use 'ObjectCreationExpression'\n /// not 'ObjectCreation'. This prevents accidental duplication and keeps consistency with all members.\n /// \n /// \n /// \n /// \n /// Many helpers in this type currently violate the above 'dos' and 'do nots'. They should be removed and either \n /// inlined directly into the feature that needs if (if only a single feature), or moved into a dedicated service\n /// for that purpose if needed by multiple features.\n /// \n internal interface ISyntaxFacts\n {\n bool IsCaseSensitive { get; }\n StringComparer StringComparer { get; }\n\n SyntaxTrivia ElasticMarker { get; }\n SyntaxTrivia ElasticCarriageReturnLineFeed { get; }\n\n ISyntaxKinds SyntaxKinds { get; }\n\n bool SupportsIndexingInitializer(ParseOptions options);\n bool SupportsLocalFunctionDeclaration(ParseOptions options);\n bool SupportsNotPattern(ParseOptions options);\n bool SupportsRecord(ParseOptions options);\n bool SupportsRecordStruct(ParseOptions options);\n bool SupportsThrowExpression(ParseOptions options);\n\n SyntaxToken ParseToken(string text);\n SyntaxTriviaList ParseLeadingTrivia(string text);\n string EscapeIdentifier(string identifier);\n bool IsVerbatimIdentifier(SyntaxToken token);\n bool IsOperator(SyntaxToken token);\n bool IsPredefinedType(SyntaxToken token);\n bool IsPredefinedType(SyntaxToken token, PredefinedType type);\n bool IsPredefinedOperator(SyntaxToken token);\n bool IsPredefinedOperator(SyntaxToken token, PredefinedOperator op);\n\n /// \n /// Returns 'true' if this a 'reserved' keyword for the language. A 'reserved' keyword is a\n /// identifier that is always treated as being a special keyword, regardless of where it is\n /// found in the token stream. Examples of this are tokens like and\n /// in C# and VB respectively.\n ///\n /// Importantly, this does *not* include contextual keywords. If contextual keywords are\n /// important for your scenario, use or . Also, consider using\n /// if all you need is the ability to know\n /// if this is effectively any identifier in the language, regardless of whether the language\n /// is treating it as a keyword or not.\n /// \n bool IsReservedKeyword(SyntaxToken token);\n\n /// \n /// Returns if this a 'contextual' keyword for the language. A\n /// 'contextual' keyword is a identifier that is only treated as being a special keyword in\n /// certain *syntactic* contexts. Examples of this is 'yield' in C#. This is only a\n /// keyword if used as 'yield return' or 'yield break'. Importantly, identifiers like , and are *not*\n /// 'contextual' keywords. This is because they are not treated as keywords depending on\n /// the syntactic context around them. Instead, the language always treats them identifiers\n /// that have special *semantic* meaning if they end up not binding to an existing symbol.\n ///\n /// Importantly, if is not in the syntactic construct where the\n /// language thinks an identifier should be contextually treated as a keyword, then this\n /// will return .\n ///\n /// Or, in other words, the parser must be able to identify these cases in order to be a\n /// contextual keyword. If identification happens afterwards, it's not contextual.\n /// \n bool IsContextualKeyword(SyntaxToken token);\n\n /// \n /// The set of identifiers that have special meaning directly after the `#` token in a\n /// preprocessor directive. For example `if` or `pragma`.\n /// \n bool IsPreprocessorKeyword(SyntaxToken token);\n bool IsPreProcessorDirectiveContext(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);\n\n bool IsLiteral(SyntaxToken token);\n bool IsStringLiteralOrInterpolatedStringLiteral(SyntaxToken token);\n\n bool IsNumericLiteral(SyntaxToken token);\n bool IsVerbatimStringLiteral(SyntaxToken token);\n\n bool IsUsingOrExternOrImport([NotNullWhen(true)] SyntaxNode? node);\n bool IsGlobalAssemblyAttribute([NotNullWhen(true)] SyntaxNode? node);\n bool IsGlobalModuleAttribute([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeclaration(SyntaxNode node);\n bool IsTypeDeclaration(SyntaxNode node);\n\n bool IsUsingAliasDirective([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsRegularComment(SyntaxTrivia trivia);\n bool IsDocumentationComment(SyntaxTrivia trivia);\n bool IsElastic(SyntaxTrivia trivia);\n bool IsPragmaDirective(SyntaxTrivia trivia, out bool isDisable, out bool isActive, out SeparatedSyntaxList errorCodes);\n\n bool IsPreprocessorDirective(SyntaxTrivia trivia);\n\n bool IsDocumentationComment(SyntaxNode node);\n\n string GetText(int kind);\n bool IsEntirelyWithinStringOrCharOrNumericLiteral([NotNullWhen(true)] SyntaxTree? syntaxTree, int position, CancellationToken cancellationToken);\n\n bool TryGetPredefinedType(SyntaxToken token, out PredefinedType type);\n bool TryGetPredefinedOperator(SyntaxToken token, out PredefinedOperator op);\n bool TryGetExternalSourceInfo([NotNullWhen(true)] SyntaxNode? directive, out ExternalSourceInfo info);\n\n bool IsDeclarationExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsIsExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsIsPatternExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsConversionExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsCastExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsExpressionOfForeach([NotNullWhen(true)] SyntaxNode? node);\n\n void GetPartsOfTupleExpression(SyntaxNode node,\n out SyntaxToken openParen, out SeparatedSyntaxList arguments, out SyntaxToken closeParen) where TArgumentSyntax : SyntaxNode;\n\n void GetPartsOfInterpolationExpression(SyntaxNode node,\n out SyntaxToken stringStartToken, out SyntaxList contents, out SyntaxToken stringEndToken);\n\n bool IsVerbatimInterpolatedStringExpression(SyntaxNode node);\n\n // Left side of = assignment.\n bool IsLeftSideOfAssignment([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsSimpleAssignmentStatement([NotNullWhen(true)] SyntaxNode? statement);\n void GetPartsOfAssignmentStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfAssignmentExpressionOrStatement(SyntaxNode statement, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n\n // Left side of any assignment (for example = or ??= or *= or += )\n bool IsLeftSideOfAnyAssignment([NotNullWhen(true)] SyntaxNode? node);\n // Left side of compound assignment (for example ??= or *= or += )\n bool IsLeftSideOfCompoundAssignment([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode GetRightHandSideOfAssignment(SyntaxNode node);\n\n bool IsInferredAnonymousObjectMemberDeclarator([NotNullWhen(true)] SyntaxNode? node);\n bool IsOperandOfIncrementExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsOperandOfIncrementOrDecrementExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsLeftSideOfDot([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode? GetRightSideOfDot(SyntaxNode? node);\n\n /// \n /// Get the node on the left side of the dot if given a dotted expression.\n /// \n /// \n /// In VB, we have a member access expression with a null expression, this may be one of the\n /// following forms:\n /// 1) new With { .a = 1, .b = .a .a refers to the anonymous type\n /// 2) With obj : .m .m refers to the obj type\n /// 3) new T() With { .a = 1, .b = .a 'a refers to the T type\n /// If `allowImplicitTarget` is set to true, the returned node will be set to approperiate node, otherwise, it will return null.\n /// This parameter has no affect on C# node.\n /// \n SyntaxNode? GetLeftSideOfDot(SyntaxNode? node, bool allowImplicitTarget = false);\n\n bool IsLeftSideOfExplicitInterfaceSpecifier([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsNameOfSimpleMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfAnyMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// Gets the containing expression that is actually a language expression and not just typed\n /// as an ExpressionSyntax for convenience. For example, NameSyntax nodes on the right side\n /// of qualified names and member access expressions are not language expressions, yet the\n /// containing qualified names or member access expressions are indeed expressions.\n /// \n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? GetStandaloneExpression(SyntaxNode? node);\n\n /// \n /// Call on the `.y` part of a `x?.y` to get the entire `x?.y` conditional access expression. This also works\n /// when there are multiple chained conditional accesses. For example, calling this on '.y' or '.z' in\n /// `x?.y?.z` will both return the full `x?.y?.z` node. This can be used to effectively get 'out' of the RHS of\n /// a conditional access, and commonly represents the full standalone expression that can be operated on\n /// atomically.\n /// \n SyntaxNode? GetRootConditionalAccessExpression(SyntaxNode? node);\n\n /// \n /// Returns the expression node the member is being accessed off of. If \n /// is , this will be the node directly to the left of the dot-token. If \n /// is , then this can return another node in the tree that the member will be accessed\n /// off of. For example, in VB, if you have a member-access-expression of the form \".Length\" then this\n /// may return the expression in the surrounding With-statement.\n /// \n SyntaxNode? GetExpressionOfMemberAccessExpression(SyntaxNode node, bool allowImplicitTarget = false);\n\n SyntaxNode? GetTargetOfMemberBinding(SyntaxNode? node);\n\n SyntaxNode GetNameOfMemberBindingExpression(SyntaxNode node);\n\n bool IsPointerMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n bool IsNameOfNamedArgument([NotNullWhen(true)] SyntaxNode? node);\n SyntaxToken? GetNameOfParameter([NotNullWhen(true)] SyntaxNode? node);\n SyntaxNode? GetDefaultOfParameter(SyntaxNode node);\n SyntaxNode? GetParameterList(SyntaxNode node);\n bool IsParameterList([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDocumentationCommentExteriorTrivia(SyntaxTrivia trivia);\n\n void GetPartsOfElementAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode argumentList);\n\n SyntaxNode GetExpressionOfArgument(SyntaxNode node);\n SyntaxNode GetExpressionOfInterpolation(SyntaxNode node);\n SyntaxNode GetNameOfAttribute(SyntaxNode node);\n\n bool IsMemberBindingExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsPostfixUnaryExpression([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxToken GetIdentifierOfGenericName(SyntaxNode node);\n SyntaxToken GetIdentifierOfSimpleName(SyntaxNode node);\n SyntaxToken GetIdentifierOfParameter(SyntaxNode node);\n SyntaxToken GetIdentifierOfTypeDeclaration(SyntaxNode node);\n SyntaxToken GetIdentifierOfVariableDeclarator(SyntaxNode node);\n SyntaxToken GetIdentifierOfIdentifierName(SyntaxNode node);\n SyntaxNode GetTypeOfVariableDeclarator(SyntaxNode node);\n\n /// \n /// True if this is an argument with just an expression and nothing else (i.e. no ref/out,\n /// no named params, no omitted args).\n /// \n bool IsSimpleArgument([NotNullWhen(true)] SyntaxNode? node);\n bool IsArgument([NotNullWhen(true)] SyntaxNode? node);\n RefKind GetRefKindOfArgument(SyntaxNode node);\n\n void GetNameAndArityOfSimpleName(SyntaxNode node, out string name, out int arity);\n bool LooksGeneric(SyntaxNode simpleName);\n\n SyntaxList GetContentsOfInterpolatedString(SyntaxNode interpolatedString);\n\n SeparatedSyntaxList GetArgumentsOfInvocationExpression(SyntaxNode node);\n SeparatedSyntaxList GetArgumentsOfObjectCreationExpression(SyntaxNode node);\n SeparatedSyntaxList GetArgumentsOfArgumentList(SyntaxNode node);\n\n bool IsUsingDirectiveName([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsAttributeName(SyntaxNode node);\n // Violation. Doesn't correspond to any shared structure for vb/c#\n SyntaxList GetAttributeLists(SyntaxNode? node);\n\n bool IsAttributeNamedArgumentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberInitializerNamedAssignmentIdentifier([NotNullWhen(true)] SyntaxNode? node, [NotNullWhen(true)] out SyntaxNode? initializedInstance);\n\n bool IsDirective([NotNullWhen(true)] SyntaxNode? node);\n bool IsStatement([NotNullWhen(true)] SyntaxNode? node);\n bool IsExecutableStatement([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDeconstructionAssignment([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeconstructionForEachStatement([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// Returns true for nodes that represent the body of a method.\n ///\n /// For VB this will be\n /// MethodBlockBaseSyntax. This will be true for things like constructor, method, operator\n /// bodies as well as accessor bodies. It will not be true for things like sub() function()\n /// lambdas.\n ///\n /// For C# this will be the BlockSyntax or ArrowExpressionSyntax for a\n /// method/constructor/deconstructor/operator/accessor. It will not be included for local\n /// functions.\n /// \n bool IsMethodBody([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsDeclaratorOfLocalDeclarationStatement(SyntaxNode declarator, SyntaxNode localDeclarationStatement);\n SeparatedSyntaxList GetVariablesOfLocalDeclarationStatement(SyntaxNode node);\n SyntaxNode? GetInitializerOfVariableDeclarator(SyntaxNode node);\n\n bool IsThisConstructorInitializer(SyntaxToken token);\n bool IsBaseConstructorInitializer(SyntaxToken token);\n bool IsQueryKeyword(SyntaxToken token);\n bool IsElementAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsIndexerMemberCRef([NotNullWhen(true)] SyntaxNode? node);\n bool IsIdentifierStartCharacter(char c);\n bool IsIdentifierPartCharacter(char c);\n bool IsIdentifierEscapeCharacter(char c);\n bool IsStartOfUnicodeEscapeSequence(char c);\n\n bool IsValidIdentifier(string identifier);\n bool IsVerbatimIdentifier(string identifier);\n\n /// \n /// Returns true if the given character is a character which may be included in an\n /// identifier to specify the type of a variable.\n /// \n bool IsTypeCharacter(char c);\n\n // Violation. This is a feature level API for QuickInfo.\n bool IsBindableToken(SyntaxToken token);\n\n bool IsInStaticContext(SyntaxNode node);\n bool IsUnsafeContext(SyntaxNode node);\n\n bool IsInNamespaceOrTypeContext([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsBaseTypeList([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsInConstantContext([NotNullWhen(true)] SyntaxNode? node);\n bool IsInConstructor(SyntaxNode node);\n bool IsMethodLevelMember([NotNullWhen(true)] SyntaxNode? node);\n bool IsTopLevelNodeWithMembers([NotNullWhen(true)] SyntaxNode? node);\n bool HasIncompleteParentMember([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// A block that has no semantics other than introducing a new scope. That is only C# BlockSyntax.\n /// \n bool IsScopeBlock([NotNullWhen(true)] SyntaxNode? node);\n\n /// \n /// A node that contains a list of statements. In C#, this is BlockSyntax and SwitchSectionSyntax.\n /// In VB, this includes all block statements such as a MultiLineIfBlockSyntax.\n /// \n bool IsExecutableBlock([NotNullWhen(true)] SyntaxNode? node);\n // Violation. This should return a SyntaxList\n IReadOnlyList GetExecutableBlockStatements(SyntaxNode? node);\n // Violation. This is a feature level API.\n SyntaxNode? FindInnermostCommonExecutableBlock(IEnumerable nodes);\n\n /// \n /// A node that can host a list of statements or a single statement. In addition to\n /// every \"executable block\", this also includes C# embedded statement owners.\n /// \n // Violation. This is a feature level API.\n bool IsStatementContainer([NotNullWhen(true)] SyntaxNode? node);\n\n // Violation. This is a feature level API.\n IReadOnlyList GetStatementContainerStatements(SyntaxNode? node);\n\n bool AreEquivalent(SyntaxToken token1, SyntaxToken token2);\n bool AreEquivalent(SyntaxNode? node1, SyntaxNode? node2);\n\n string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, string? rootNamespace = null);\n\n // Violation. This is a feature level API. How 'position' relates to 'containment' is not defined.\n SyntaxNode? GetContainingTypeDeclaration(SyntaxNode? root, int position);\n SyntaxNode? GetContainingMemberDeclaration(SyntaxNode? root, int position, bool useFullSpan = true);\n SyntaxNode? GetContainingVariableDeclaratorOfFieldDeclaration(SyntaxNode? node);\n\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? WalkDownParentheses(SyntaxNode? node);\n\n // Violation. This is a feature level API.\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? ConvertToSingleLine(SyntaxNode? node, bool useElasticTrivia = false);\n\n // Violation. This is a feature level API.\n List GetTopLevelAndMethodLevelMembers(SyntaxNode? root);\n // Violation. This is a feature level API.\n List GetMethodLevelMembers(SyntaxNode? root);\n SyntaxList GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration);\n\n // Violation. This is a feature level API.\n bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span);\n // Violation. This is a feature level API.\n TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken);\n\n /// \n /// Given a , return the representing the span of the member body\n /// it is contained within. This is used to determine whether speculative binding should be\n /// used in performance-critical typing scenarios. Note: if this method fails to find a relevant span, it returns\n /// an empty at position 0.\n /// \n // Violation. This is a feature level API.\n TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node);\n\n /// \n /// Returns the parent node that binds to the symbols that the IDE prefers for features like Quick Info and Find\n /// All References. For example, if the token is part of the type of an object creation, the parenting object\n /// creation expression is returned so that binding will return constructor symbols.\n /// \n // Violation. This is a feature level API.\n SyntaxNode? TryGetBindableParent(SyntaxToken token);\n\n // Violation. This is a feature level API.\n IEnumerable GetConstructors(SyntaxNode? root, CancellationToken cancellationToken);\n // Violation. This is a feature level API.\n bool TryGetCorrespondingOpenBrace(SyntaxToken token, out SyntaxToken openBrace);\n\n /// \n /// Given a , that represents and argument return the string representation of\n /// that arguments name.\n /// \n // Violation. This is a feature level API.\n string GetNameForArgument(SyntaxNode? argument);\n\n /// \n /// Given a , that represents an attribute argument return the string representation of\n /// that arguments name.\n /// \n // Violation. This is a feature level API.\n string GetNameForAttributeArgument(SyntaxNode? argument);\n\n bool IsNameOfSubpattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsPropertyPatternClause(SyntaxNode node);\n\n bool IsAnyPattern([NotNullWhen(true)] SyntaxNode? node);\n\n bool IsAndPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsBinaryPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsConstantPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsDeclarationPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsNotPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsOrPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsParenthesizedPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsRecursivePattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsTypePattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsUnaryPattern([NotNullWhen(true)] SyntaxNode? node);\n bool IsVarPattern([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxNode GetExpressionOfConstantPattern(SyntaxNode node);\n SyntaxNode GetTypeOfTypePattern(SyntaxNode node);\n\n void GetPartsOfParenthesizedPattern(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode pattern, out SyntaxToken closeParen);\n void GetPartsOfBinaryPattern(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfDeclarationPattern(SyntaxNode node, out SyntaxNode type, out SyntaxNode designation);\n void GetPartsOfRecursivePattern(SyntaxNode node, out SyntaxNode? type, out SyntaxNode? positionalPart, out SyntaxNode? propertyPart, out SyntaxNode? designation);\n void GetPartsOfUnaryPattern(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode pattern);\n\n bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);\n\n SyntaxTokenList GetModifiers(SyntaxNode? node);\n\n // Violation. WithXXX methods should not be here, but should be in SyntaxGenerator.\n [return: NotNullIfNotNull(\"node\")]\n SyntaxNode? WithModifiers(SyntaxNode? node, SyntaxTokenList modifiers);\n\n // Violation. This is a feature level API.\n Location GetDeconstructionReferenceLocation(SyntaxNode node);\n\n // Violation. This is a feature level API.\n SyntaxToken? GetDeclarationIdentifierIfOverride(SyntaxToken token);\n\n bool IsParameterNameXmlElementSyntax([NotNullWhen(true)] SyntaxNode? node);\n\n SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia);\n\n #region IsXXX members\n\n bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsBaseNamespaceDeclaration([NotNullWhen(true)] SyntaxNode? node);\n bool IsBinaryExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsLiteralExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsMemberAccessExpression([NotNullWhen(true)] SyntaxNode? node);\n bool IsSimpleName([NotNullWhen(true)] SyntaxNode? node);\n\n #endregion\n\n #region GetPartsOfXXX members\n\n void GetPartsOfBaseNamespaceDeclaration(SyntaxNode node, out SyntaxNode name, out SyntaxList imports, out SyntaxList members);\n void GetPartsOfBinaryExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken operatorToken, out SyntaxNode right);\n void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode expression);\n void GetPartsOfCompilationUnit(SyntaxNode node, out SyntaxList imports, out SyntaxList attributeLists, out SyntaxList members);\n void GetPartsOfConditionalAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode whenNotNull);\n void GetPartsOfConditionalExpression(SyntaxNode node, out SyntaxNode condition, out SyntaxNode whenTrue, out SyntaxNode whenFalse);\n void GetPartsOfInvocationExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxNode? argumentList);\n void GetPartsOfIsPatternExpression(SyntaxNode node, out SyntaxNode left, out SyntaxToken isToken, out SyntaxNode right);\n void GetPartsOfMemberAccessExpression(SyntaxNode node, out SyntaxNode expression, out SyntaxToken operatorToken, out SyntaxNode name);\n void GetPartsOfObjectCreationExpression(SyntaxNode node, out SyntaxNode type, out SyntaxNode? argumentList, out SyntaxNode? initializer);\n void GetPartsOfParenthesizedExpression(SyntaxNode node, out SyntaxToken openParen, out SyntaxNode expression, out SyntaxToken closeParen);\n void GetPartsOfPrefixUnaryExpression(SyntaxNode node, out SyntaxToken operatorToken, out SyntaxNode operand);\n void GetPartsOfQualifiedName(SyntaxNode node, out SyntaxNode left, out SyntaxToken dotToken, out SyntaxNode right);\n void GetPartsOfUsingAliasDirective(SyntaxNode node, out SyntaxToken globalKeyword, out SyntaxToken alias, out SyntaxNode name);\n\n #endregion\n\n #region GetXXXOfYYYMembers\n\n // note: this is only for nodes that have a single child nodes. If a node has multiple child nodes, then\n // ISyntaxFacts should have a GetPartsOfXXX helper instead, and GetXXXOfYYY should be built off of that\n // inside ISyntaxFactsExtensions\n\n SyntaxNode GetExpressionOfAwaitExpression(SyntaxNode node);\n SyntaxNode GetExpressionOfExpressionStatement(SyntaxNode node);\n SyntaxNode? GetExpressionOfReturnStatement(SyntaxNode node);\n SyntaxNode GetExpressionOfThrowExpression(SyntaxNode node);\n SyntaxNode? GetValueOfEqualsValueClause(SyntaxNode? node);\n\n #endregion\n }\n\n [Flags]\n internal enum DisplayNameOptions\n {\n None = 0,\n IncludeMemberKeyword = 1,\n IncludeNamespaces = 1 << 1,\n IncludeParameters = 1 << 2,\n IncludeType = 1 << 3,\n IncludeTypeParameters = 1 << 4\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":210,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFactsExtensions.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n internal static class ISyntaxFactsExtensions\n {\n private static readonly ObjectPool> s_stackPool\n = SharedPools.Default>();\n\n public static bool IsOnSingleLine(this ISyntaxFacts syntaxFacts, SyntaxNode node, bool fullSpan)\n {\n // The stack logic assumes the initial node is not null\n Contract.ThrowIfNull(node);\n\n // Use an actual Stack so we can write out deeply recursive structures without overflowing.\n // Note: algorithm is taken from GreenNode.WriteTo.\n //\n // General approach is that we recurse down the nodes, using a real stack object to\n // keep track of what node we're on. If full-span is true we'll examine all tokens\n // and all the trivia on each token. If full-span is false we'll examine all tokens\n // but we'll ignore the leading trivia on the very first trivia and the trailing trivia\n // on the very last token.\n var stack = s_stackPool.Allocate();\n stack.Push((node, leading: fullSpan, trailing: fullSpan));\n\n var result = IsOnSingleLine(syntaxFacts, stack);\n\n s_stackPool.ClearAndFree(stack);\n\n return result;\n }\n\n private static bool IsOnSingleLine(\n ISyntaxFacts syntaxFacts, Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)> stack)\n {\n while (stack.Count > 0)\n {\n var (currentNodeOrToken, currentLeading, currentTrailing) = stack.Pop();\n if (currentNodeOrToken.IsToken)\n {\n // If this token isn't on a single line, then the original node definitely\n // isn't on a single line.\n if (!IsOnSingleLine(syntaxFacts, currentNodeOrToken.AsToken(), currentLeading, currentTrailing))\n return false;\n }\n else\n {\n var currentNode = currentNodeOrToken.AsNode()!;\n\n var childNodesAndTokens = currentNode.ChildNodesAndTokens();\n var childCount = childNodesAndTokens.Count;\n\n // Walk the children of this node in reverse, putting on the stack to process.\n // This way we process the children in the actual child-order they are in for\n // this node.\n var index = 0;\n foreach (var child in childNodesAndTokens.Reverse())\n {\n // Since we're walking the children in reverse, if we're on hte 0th item,\n // that's the last child.\n var last = index == 0;\n\n // Once we get all the way to the end of the reversed list, we're actually\n // on the first.\n var first = index == childCount - 1;\n\n // We want the leading trivia if we've asked for it, or if we're not the first\n // token being processed. We want the trailing trivia if we've asked for it,\n // or if we're not the last token being processed.\n stack.Push((child, currentLeading | !first, currentTrailing | !last));\n index++;\n }\n }\n }\n\n // All tokens were on a single line. This node is on a single line.\n return true;\n }\n\n private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxToken token, bool leading, bool trailing)\n {\n // If any of our trivia is not on a single line, then we're not on a single line.\n if (!IsOnSingleLine(syntaxFacts, token.LeadingTrivia, leading) ||\n !IsOnSingleLine(syntaxFacts, token.TrailingTrivia, trailing))\n {\n return false;\n }\n\n // Only string literals can span multiple lines. Only need to check those.\n if (syntaxFacts.SyntaxKinds.StringLiteralToken == token.RawKind ||\n syntaxFacts.SyntaxKinds.InterpolatedStringTextToken == token.RawKind)\n {\n // This allocated. But we only do it in the string case. For all other tokens\n // we don't need any allocations.\n if (!IsOnSingleLine(token.ToString()))\n {\n return false;\n }\n }\n\n // Any other type of token is on a single line.\n return true;\n }\n\n private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList, bool checkTrivia)\n {\n if (checkTrivia)\n {\n foreach (var trivia in triviaList)\n {\n if (trivia.HasStructure)\n {\n // For structured trivia, we recurse into the trivia to see if it\n // is on a single line or not. If it isn't, then we're definitely\n // not on a single line.\n if (!IsOnSingleLine(syntaxFacts, trivia.GetStructure()!, fullSpan: true))\n {\n return false;\n }\n }\n else if (syntaxFacts.IsEndOfLineTrivia(trivia))\n {\n // Contained an end-of-line trivia. Definitely not on a single line.\n return false;\n }\n else if (!syntaxFacts.IsWhitespaceTrivia(trivia))\n {\n // Was some other form of trivia (like a comment). Easiest thing\n // to do is just stringify this and count the number of newlines.\n // these should be rare. So the allocation here is ok.\n if (!IsOnSingleLine(trivia.ToString()))\n {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n private static bool IsOnSingleLine(string value)\n => value.GetNumberOfLineBreaks() == 0;\n\n public static bool ContainsInterleavedDirective(\n this ISyntaxFacts syntaxFacts, ImmutableArray nodes, CancellationToken cancellationToken)\n {\n if (nodes.Length > 0)\n {\n var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End);\n\n foreach (var node in nodes)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n if (ContainsInterleavedDirective(syntaxFacts, span, node, cancellationToken))\n return true;\n }\n }\n\n return false;\n }\n\n public static bool ContainsInterleavedDirective(this ISyntaxFacts syntaxFacts, SyntaxNode node, CancellationToken cancellationToken)\n => ContainsInterleavedDirective(syntaxFacts, node.Span, node, cancellationToken);\n\n public static bool ContainsInterleavedDirective(\n this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken)\n {\n foreach (var token in node.DescendantTokens())\n {\n if (syntaxFacts.ContainsInterleavedDirective(span, token, cancellationToken))\n return true;\n }\n\n return false;\n }\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, IEnumerable nodes)\n {\n if (nodes == null || nodes.IsEmpty())\n {\n return false;\n }\n\n return SpansPreprocessorDirective(syntaxFacts, nodes.SelectMany(n => n.DescendantTokens()));\n }\n\n /// \n /// Determines if there is preprocessor trivia *between* any of the \n /// provided. The will be deduped and then ordered by position.\n /// Specifically, the first token will not have it's leading trivia checked, and the last\n /// token will not have it's trailing trivia checked. All other trivia will be checked to\n /// see if it contains a preprocessor directive.\n /// \n public static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, IEnumerable tokens)\n {\n // we want to check all leading trivia of all tokens (except the \n // first one), and all trailing trivia of all tokens (except the\n // last one).\n\n var first = true;\n var previousToken = default(SyntaxToken);\n\n // Allow duplicate nodes/tokens to be passed in. Also, allow the nodes/tokens\n // to not be in any particular order when passed in.\n var orderedTokens = tokens.Distinct().OrderBy(t => t.SpanStart);\n\n foreach (var token in orderedTokens)\n {\n if (first)\n {\n first = false;\n }\n else\n {\n // check the leading trivia of this token, and the trailing trivia\n // of the previous token.\n if (SpansPreprocessorDirective(syntaxFacts, token.LeadingTrivia) ||\n SpansPreprocessorDirective(syntaxFacts, previousToken.TrailingTrivia))\n {\n return true;\n }\n }\n\n previousToken = token;\n }\n\n return false;\n }\n\n private static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, SyntaxTriviaList list)\n => list.Any(t => syntaxFacts.IsPreprocessorDirective(t));\n\n public static bool IsLegalIdentifier(this ISyntaxFacts syntaxFacts, string name)\n {\n if (name.Length == 0)\n {\n return false;\n }\n\n if (!syntaxFacts.IsIdentifierStartCharacter(name[0]))\n {\n return false;\n }\n\n for (var i = 1; i < name.Length; i++)\n {\n if (!syntaxFacts.IsIdentifierPartCharacter(name[i]))\n {\n return false;\n }\n }\n\n return true;\n }\n\n public static bool IsReservedOrContextualKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => syntaxFacts.IsReservedKeyword(token) || syntaxFacts.IsContextualKeyword(token);\n\n public static bool IsWord(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n {\n return syntaxFacts.IsIdentifier(token)\n || syntaxFacts.IsReservedOrContextualKeyword(token)\n || syntaxFacts.IsPreprocessorKeyword(token);\n }\n\n public static bool IsRegularOrDocumentationComment(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => syntaxFacts.IsRegularComment(trivia) || syntaxFacts.IsDocumentationComment(trivia);\n\n public static void GetPartsOfAssignmentStatement(\n this ISyntaxFacts syntaxFacts, SyntaxNode statement,\n out SyntaxNode left, out SyntaxNode right)\n {\n syntaxFacts.GetPartsOfAssignmentStatement(statement, out left, out _, out right);\n }\n\n public static SyntaxNode GetExpressionOfInvocationExpression(\n this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfInvocationExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxNode Unparenthesize(\n this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n SyntaxToken openParenToken;\n SyntaxNode operand;\n SyntaxToken closeParenToken;\n\n if (syntaxFacts.IsParenthesizedPattern(node))\n {\n syntaxFacts.GetPartsOfParenthesizedPattern(node,\n out openParenToken, out operand, out closeParenToken);\n }\n else\n {\n syntaxFacts.GetPartsOfParenthesizedExpression(node,\n out openParenToken, out operand, out closeParenToken);\n }\n\n var leadingTrivia = openParenToken.LeadingTrivia\n .Concat(openParenToken.TrailingTrivia)\n .Where(t => !syntaxFacts.IsElastic(t))\n .Concat(operand.GetLeadingTrivia());\n\n var trailingTrivia = operand.GetTrailingTrivia()\n .Concat(closeParenToken.LeadingTrivia)\n .Where(t => !syntaxFacts.IsElastic(t))\n .Concat(closeParenToken.TrailingTrivia);\n\n var resultNode = operand\n .WithLeadingTrivia(leadingTrivia)\n .WithTrailingTrivia(trailingTrivia);\n\n // If there's no trivia between the original node and the tokens around it, then add\n // elastic markers so the formatting engine will spaces if necessary to keep things\n // parseable.\n if (resultNode.GetLeadingTrivia().Count == 0)\n {\n var previousToken = node.GetFirstToken().GetPreviousToken();\n if (previousToken.TrailingTrivia.Count == 0 &&\n syntaxFacts.IsWordOrNumber(previousToken) &&\n syntaxFacts.IsWordOrNumber(resultNode.GetFirstToken()))\n {\n resultNode = resultNode.WithPrependedLeadingTrivia(syntaxFacts.ElasticMarker);\n }\n }\n\n if (resultNode.GetTrailingTrivia().Count == 0)\n {\n var nextToken = node.GetLastToken().GetNextToken();\n if (nextToken.LeadingTrivia.Count == 0 &&\n syntaxFacts.IsWordOrNumber(nextToken) &&\n syntaxFacts.IsWordOrNumber(resultNode.GetLastToken()))\n {\n resultNode = resultNode.WithAppendedTrailingTrivia(syntaxFacts.ElasticMarker);\n }\n }\n\n return resultNode;\n }\n\n private static bool IsWordOrNumber(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => syntaxFacts.IsWord(token) || syntaxFacts.IsNumericLiteral(token);\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts service, SyntaxNode node)\n => service.SpansPreprocessorDirective(SpecializedCollections.SingletonEnumerable(node));\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts service, params SyntaxNode[] nodes)\n => service.SpansPreprocessorDirective(nodes);\n\n public static bool IsWhitespaceOrEndOfLineTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => syntaxFacts.IsWhitespaceTrivia(trivia) || syntaxFacts.IsEndOfLineTrivia(trivia);\n\n public static void GetPartsOfBinaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode left, out SyntaxNode right)\n => syntaxFacts.GetPartsOfBinaryExpression(node, out left, out _, out right);\n\n public static SyntaxNode GetPatternOfParenthesizedPattern(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfParenthesizedPattern(node, out _, out var pattern, out _);\n return pattern;\n }\n\n public static SyntaxToken GetOperatorTokenOfBinaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBinaryExpression(node, out _, out var token, out _);\n return token;\n }\n\n public static bool IsAnonymousOrLocalFunction(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n => syntaxFacts.IsAnonymousFunctionExpression(node) ||\n syntaxFacts.IsLocalFunctionStatement(node);\n\n public static SyntaxNode? GetExpressionOfElementAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfElementAccessExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxNode? GetArgumentListOfElementAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfElementAccessExpression(node, out _, out var argumentList);\n return argumentList;\n }\n\n public static SyntaxNode GetExpressionOfConditionalAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfConditionalAccessExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxToken GetOperatorTokenOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfMemberAccessExpression(node, out _, out var operatorToken, out _);\n return operatorToken;\n }\n\n public static void GetPartsOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode expression, out SyntaxNode name)\n => syntaxFacts.GetPartsOfMemberAccessExpression(node, out expression, out _, out name);\n\n public static void GetPartsOfConditionalAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode expression, out SyntaxNode whenNotNull)\n => syntaxFacts.GetPartsOfConditionalAccessExpression(node, out expression, out _, out whenNotNull);\n\n public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node)\n {\n // Span without AttributeLists\n // - No AttributeLists -> original .Span\n // - Some AttributeLists -> (first non-trivia/comment Token.Span.Begin, original.Span.End)\n // - We need to be mindful about comments due to:\n // // [Test1]\n // //Comment1\n // [||]object Property1 { get; set; }\n // the comment node being part of the next token's (`object`) leading trivia and not the AttributeList's node.\n // - In case only attribute is written we need to be careful to not to use next (unrelated) token as beginning current the node.\n var attributeList = syntaxFacts.GetAttributeLists(node);\n if (attributeList.Any())\n {\n var endOfAttributeLists = attributeList.Last().Span.End;\n var afterAttributesToken = root.FindTokenOnRightOfPosition(endOfAttributeLists);\n\n var endOfNode = node.Span.End;\n var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);\n\n return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);\n }\n\n return node.Span;\n }\n\n /// \n /// Gets the statement container node for the statement .\n /// \n /// The implementation.\n /// The statement.\n /// The statement container for .\n public static SyntaxNode? GetStatementContainer(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n for (var current = node; current is object; current = current.Parent)\n {\n if (syntaxFacts.IsStatementContainer(current.Parent))\n {\n return current.Parent;\n }\n }\n\n return null;\n }\n\n /// \n /// Similar to , this gets the containing\n /// expression that is actually a language expression and not just typed as an ExpressionSyntax for convenience.\n /// However, this goes beyond that that method in that if this expression is the RHS of a conditional access\n /// (i.e. a?.b()) it will also return the root of the conditional access expression tree.\n /// The intuition here is that this will give the topmost expression node that could realistically be\n /// replaced with any other expression. For example, with a?.b() technically .b() is an\n /// expression. But that cannot be replaced with something like (1 + 1) (as a?.(1 + 1) is not\n /// legal). However, in a?.b(), then a itself could be replaced with (1 + 1)?.b() to form\n /// a legal expression.\n /// \n public static SyntaxNode GetRootStandaloneExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n // First, make sure we're on a construct the language things is a standalone expression.\n var standalone = syntaxFacts.GetStandaloneExpression(node);\n\n // Then, if this is the RHS of a `?`, walk up to the top of that tree to get the final standalone expression.\n return syntaxFacts.GetRootConditionalAccessExpression(standalone) ?? standalone;\n }\n\n #region GetXXXOfYYY Members\n\n public static SyntaxNode? GetArgumentListOfInvocationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfInvocationExpression(node, out _, out var argumentList);\n return argumentList;\n }\n\n public static SyntaxNode? GetArgumentListOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out _, out var argumentList, out _);\n return argumentList;\n }\n\n public static SyntaxNode GetExpressionOfParenthesizedExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfParenthesizedExpression(node, out _, out var expression, out _);\n return expression;\n }\n\n public static SyntaxList GetImportsOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out _, out var imports, out _);\n return imports;\n }\n\n public static SyntaxList GetImportsOfCompilationUnit(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfCompilationUnit(node, out var imports, out _, out _);\n return imports;\n }\n\n public static SyntaxNode? GetInitializerOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out _, out _, out var initializer);\n return initializer;\n }\n\n public static SyntaxList GetMembersOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out _, out _, out var members);\n return members;\n }\n\n public static SyntaxList GetMembersOfCompilationUnit(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfCompilationUnit(node, out _, out _, out var members);\n return members;\n }\n\n public static SyntaxNode GetNameOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out var name, out _, out _);\n return name;\n }\n\n public static SyntaxNode GetNameOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfMemberAccessExpression(node, out _, out var name);\n return name;\n }\n\n public static SyntaxNode GetOperandOfPrefixUnaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfPrefixUnaryExpression(node, out _, out var operand);\n return operand;\n }\n\n public static SyntaxToken GetOperatorTokenOfPrefixUnaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfPrefixUnaryExpression(node, out var operatorToken, out _);\n return operatorToken;\n }\n\n public static SyntaxNode GetTypeOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out var type, out _, out _);\n return type;\n }\n\n #endregion\n\n #region IsXXXOfYYY members\n\n public static bool IsExpressionOfAwaitExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsAwaitExpression(parent))\n return false;\n\n return node == syntaxFacts.GetExpressionOfAwaitExpression(parent);\n }\n\n public static bool IsExpressionOfInvocationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsInvocationExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfInvocationExpression(parent, out var expression, out _);\n return node == expression;\n }\n\n public static bool IsExpressionOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsMemberAccessExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfMemberAccessExpression(parent, out var expression, out _);\n return node == expression;\n }\n\n public static bool IsRightOfQualifiedName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsQualifiedName(parent))\n return false;\n\n syntaxFacts.GetPartsOfQualifiedName(parent, out _, out _, out var right);\n return node == right;\n }\n\n public static bool IsTypeOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsObjectCreationExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfObjectCreationExpression(parent, out var type, out _, out _);\n return type == node;\n }\n\n #endregion\n\n #region ISyntaxKinds forwarding methods\n\n #region trivia\n\n public static bool IsEndOfLineTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.EndOfLineTrivia;\n\n public static bool IsWhitespaceTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.WhitespaceTrivia;\n\n public static bool IsSkippedTokensTrivia(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.SkippedTokensTrivia;\n\n #endregion\n\n #region keywords\n\n public static bool IsAwaitKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.AwaitKeyword;\n\n public static bool IsGlobalNamespaceKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.GlobalKeyword;\n\n #endregion\n\n #region literal tokens\n\n public static bool IsCharacterLiteral(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralToken;\n\n public static bool IsStringLiteral(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.StringLiteralToken;\n\n #endregion\n\n #region tokens\n\n public static bool IsIdentifier(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.IdentifierToken;\n\n public static bool IsHashToken(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.HashToken;\n\n public static bool IsInterpolatedStringTextToken(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringTextToken;\n\n #endregion\n\n #region names\n\n public static bool IsGenericName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.GenericName;\n\n public static bool IsIdentifierName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.IdentifierName;\n\n public static bool IsQualifiedName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.QualifiedName;\n\n #endregion\n\n #region types\n\n public static bool IsTupleType(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TupleType;\n\n #endregion\n\n #region literal expressions\n\n public static bool IsCharacterLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralExpression;\n\n public static bool IsDefaultLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.DefaultLiteralExpression;\n\n public static bool IsFalseLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.FalseLiteralExpression;\n\n public static bool IsNumericLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.NumericLiteralExpression;\n\n public static bool IsNullLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.NullLiteralExpression;\n\n public static bool IsStringLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.StringLiteralExpression;\n\n public static bool IsTrueLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TrueLiteralExpression;\n\n #endregion\n\n #region expressions\n\n public static bool IsAwaitExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.AwaitExpression;\n\n public static bool IsBaseExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.BaseExpression;\n\n public static bool IsConditionalAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ConditionalAccessExpression;\n\n public static bool IsImplicitObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.ImplicitObjectCreationExpression;\n\n public static bool IsInterpolatedStringExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringExpression;\n\n public static bool IsInterpolation(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Interpolation;\n\n public static bool IsInterpolatedStringText(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringText;\n\n public static bool IsInvocationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InvocationExpression;\n\n public static bool IsLogicalAndExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalAndExpression;\n\n public static bool IsLogicalOrExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalOrExpression;\n\n public static bool IsLogicalNotExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalNotExpression;\n\n public static bool IsObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ObjectCreationExpression;\n\n public static bool IsParenthesizedExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ParenthesizedExpression;\n\n public static bool IsQueryExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.QueryExpression;\n\n public static bool IsSimpleMemberAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.SimpleMemberAccessExpression;\n\n public static bool IsThisExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ThisExpression;\n\n public static bool IsThrowExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.ThrowExpression;\n\n public static bool IsTupleExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TupleExpression;\n\n public static bool ContainsGlobalStatement(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n => node.ChildNodes().Any(c => c.RawKind == syntaxFacts.SyntaxKinds.GlobalStatement);\n\n #endregion\n\n #region statements\n\n public static bool IsExpressionStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ExpressionStatement;\n\n public static bool IsForEachStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ForEachStatement;\n\n public static bool IsLocalDeclarationStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LocalDeclarationStatement;\n\n public static bool IsLocalFunctionStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.LocalFunctionStatement;\n\n public static bool IsLockStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LockStatement;\n\n public static bool IsReturnStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ReturnStatement;\n\n public static bool IsThrowStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ThrowStatement;\n\n public static bool IsUsingStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.UsingStatement;\n\n #endregion\n\n #region members/declarations\n\n public static bool IsAttribute(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Attribute;\n\n public static bool IsClassDeclaration(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ClassDeclaration;\n\n public static bool IsGlobalAttribute(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => syntaxFacts.IsGlobalAssemblyAttribute(node) || syntaxFacts.IsGlobalModuleAttribute(node);\n\n public static bool IsParameter(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Parameter;\n\n public static bool IsTypeConstraint(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TypeConstraint;\n\n public static bool IsVariableDeclarator(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.VariableDeclarator;\n\n public static bool IsFieldDeclaration(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.FieldDeclaration;\n\n public static bool IsTypeArgumentList(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TypeArgumentList;\n\n #endregion\n\n #region clauses\n\n public static bool IsEqualsValueClause(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.EqualsValueClause;\n\n #endregion\n\n #endregion\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.LanguageServices\n{\n internal static class ISyntaxFactsExtensions\n {\n private static readonly ObjectPool> s_stackPool\n = SharedPools.Default>();\n\n public static bool IsOnSingleLine(this ISyntaxFacts syntaxFacts, SyntaxNode node, bool fullSpan)\n {\n // The stack logic assumes the initial node is not null\n Contract.ThrowIfNull(node);\n\n // Use an actual Stack so we can write out deeply recursive structures without overflowing.\n // Note: algorithm is taken from GreenNode.WriteTo.\n //\n // General approach is that we recurse down the nodes, using a real stack object to\n // keep track of what node we're on. If full-span is true we'll examine all tokens\n // and all the trivia on each token. If full-span is false we'll examine all tokens\n // but we'll ignore the leading trivia on the very first trivia and the trailing trivia\n // on the very last token.\n var stack = s_stackPool.Allocate();\n stack.Push((node, leading: fullSpan, trailing: fullSpan));\n\n var result = IsOnSingleLine(syntaxFacts, stack);\n\n s_stackPool.ClearAndFree(stack);\n\n return result;\n }\n\n private static bool IsOnSingleLine(\n ISyntaxFacts syntaxFacts, Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)> stack)\n {\n while (stack.Count > 0)\n {\n var (currentNodeOrToken, currentLeading, currentTrailing) = stack.Pop();\n if (currentNodeOrToken.IsToken)\n {\n // If this token isn't on a single line, then the original node definitely\n // isn't on a single line.\n if (!IsOnSingleLine(syntaxFacts, currentNodeOrToken.AsToken(), currentLeading, currentTrailing))\n return false;\n }\n else\n {\n var currentNode = currentNodeOrToken.AsNode()!;\n\n var childNodesAndTokens = currentNode.ChildNodesAndTokens();\n var childCount = childNodesAndTokens.Count;\n\n // Walk the children of this node in reverse, putting on the stack to process.\n // This way we process the children in the actual child-order they are in for\n // this node.\n var index = 0;\n foreach (var child in childNodesAndTokens.Reverse())\n {\n // Since we're walking the children in reverse, if we're on hte 0th item,\n // that's the last child.\n var last = index == 0;\n\n // Once we get all the way to the end of the reversed list, we're actually\n // on the first.\n var first = index == childCount - 1;\n\n // We want the leading trivia if we've asked for it, or if we're not the first\n // token being processed. We want the trailing trivia if we've asked for it,\n // or if we're not the last token being processed.\n stack.Push((child, currentLeading | !first, currentTrailing | !last));\n index++;\n }\n }\n }\n\n // All tokens were on a single line. This node is on a single line.\n return true;\n }\n\n private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxToken token, bool leading, bool trailing)\n {\n // If any of our trivia is not on a single line, then we're not on a single line.\n if (!IsOnSingleLine(syntaxFacts, token.LeadingTrivia, leading) ||\n !IsOnSingleLine(syntaxFacts, token.TrailingTrivia, trailing))\n {\n return false;\n }\n\n // Only string literals can span multiple lines. Only need to check those.\n if (syntaxFacts.SyntaxKinds.StringLiteralToken == token.RawKind ||\n syntaxFacts.SyntaxKinds.InterpolatedStringTextToken == token.RawKind)\n {\n // This allocated. But we only do it in the string case. For all other tokens\n // we don't need any allocations.\n if (!IsOnSingleLine(token.ToString()))\n {\n return false;\n }\n }\n\n // Any other type of token is on a single line.\n return true;\n }\n\n private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList, bool checkTrivia)\n {\n if (checkTrivia)\n {\n foreach (var trivia in triviaList)\n {\n if (trivia.HasStructure)\n {\n // For structured trivia, we recurse into the trivia to see if it\n // is on a single line or not. If it isn't, then we're definitely\n // not on a single line.\n if (!IsOnSingleLine(syntaxFacts, trivia.GetStructure()!, fullSpan: true))\n {\n return false;\n }\n }\n else if (syntaxFacts.IsEndOfLineTrivia(trivia))\n {\n // Contained an end-of-line trivia. Definitely not on a single line.\n return false;\n }\n else if (!syntaxFacts.IsWhitespaceTrivia(trivia))\n {\n // Was some other form of trivia (like a comment). Easiest thing\n // to do is just stringify this and count the number of newlines.\n // these should be rare. So the allocation here is ok.\n if (!IsOnSingleLine(trivia.ToString()))\n {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n private static bool IsOnSingleLine(string value)\n => value.GetNumberOfLineBreaks() == 0;\n\n public static bool ContainsInterleavedDirective(\n this ISyntaxFacts syntaxFacts, ImmutableArray nodes, CancellationToken cancellationToken)\n {\n if (nodes.Length > 0)\n {\n var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End);\n\n foreach (var node in nodes)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n if (ContainsInterleavedDirective(syntaxFacts, span, node, cancellationToken))\n return true;\n }\n }\n\n return false;\n }\n\n public static bool ContainsInterleavedDirective(this ISyntaxFacts syntaxFacts, SyntaxNode node, CancellationToken cancellationToken)\n => ContainsInterleavedDirective(syntaxFacts, node.Span, node, cancellationToken);\n\n public static bool ContainsInterleavedDirective(\n this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken)\n {\n foreach (var token in node.DescendantTokens())\n {\n if (syntaxFacts.ContainsInterleavedDirective(span, token, cancellationToken))\n return true;\n }\n\n return false;\n }\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, IEnumerable nodes)\n {\n if (nodes == null || nodes.IsEmpty())\n {\n return false;\n }\n\n return SpansPreprocessorDirective(syntaxFacts, nodes.SelectMany(n => n.DescendantTokens()));\n }\n\n /// \n /// Determines if there is preprocessor trivia *between* any of the \n /// provided. The will be deduped and then ordered by position.\n /// Specifically, the first token will not have it's leading trivia checked, and the last\n /// token will not have it's trailing trivia checked. All other trivia will be checked to\n /// see if it contains a preprocessor directive.\n /// \n public static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, IEnumerable tokens)\n {\n // we want to check all leading trivia of all tokens (except the \n // first one), and all trailing trivia of all tokens (except the\n // last one).\n\n var first = true;\n var previousToken = default(SyntaxToken);\n\n // Allow duplicate nodes/tokens to be passed in. Also, allow the nodes/tokens\n // to not be in any particular order when passed in.\n var orderedTokens = tokens.Distinct().OrderBy(t => t.SpanStart);\n\n foreach (var token in orderedTokens)\n {\n if (first)\n {\n first = false;\n }\n else\n {\n // check the leading trivia of this token, and the trailing trivia\n // of the previous token.\n if (SpansPreprocessorDirective(syntaxFacts, token.LeadingTrivia) ||\n SpansPreprocessorDirective(syntaxFacts, previousToken.TrailingTrivia))\n {\n return true;\n }\n }\n\n previousToken = token;\n }\n\n return false;\n }\n\n private static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, SyntaxTriviaList list)\n => list.Any(t => syntaxFacts.IsPreprocessorDirective(t));\n\n public static bool IsLegalIdentifier(this ISyntaxFacts syntaxFacts, string name)\n {\n if (name.Length == 0)\n {\n return false;\n }\n\n if (!syntaxFacts.IsIdentifierStartCharacter(name[0]))\n {\n return false;\n }\n\n for (var i = 1; i < name.Length; i++)\n {\n if (!syntaxFacts.IsIdentifierPartCharacter(name[i]))\n {\n return false;\n }\n }\n\n return true;\n }\n\n public static bool IsReservedOrContextualKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => syntaxFacts.IsReservedKeyword(token) || syntaxFacts.IsContextualKeyword(token);\n\n public static bool IsWord(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n {\n return syntaxFacts.IsIdentifier(token)\n || syntaxFacts.IsReservedOrContextualKeyword(token)\n || syntaxFacts.IsPreprocessorKeyword(token);\n }\n\n public static bool IsRegularOrDocumentationComment(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => syntaxFacts.IsRegularComment(trivia) || syntaxFacts.IsDocumentationComment(trivia);\n\n public static void GetPartsOfAssignmentStatement(\n this ISyntaxFacts syntaxFacts, SyntaxNode statement,\n out SyntaxNode left, out SyntaxNode right)\n {\n syntaxFacts.GetPartsOfAssignmentStatement(statement, out left, out _, out right);\n }\n\n public static SyntaxNode GetExpressionOfInvocationExpression(\n this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfInvocationExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxNode Unparenthesize(\n this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n SyntaxToken openParenToken;\n SyntaxNode operand;\n SyntaxToken closeParenToken;\n\n if (syntaxFacts.IsParenthesizedPattern(node))\n {\n syntaxFacts.GetPartsOfParenthesizedPattern(node,\n out openParenToken, out operand, out closeParenToken);\n }\n else\n {\n syntaxFacts.GetPartsOfParenthesizedExpression(node,\n out openParenToken, out operand, out closeParenToken);\n }\n\n var leadingTrivia = openParenToken.LeadingTrivia\n .Concat(openParenToken.TrailingTrivia)\n .Where(t => !syntaxFacts.IsElastic(t))\n .Concat(operand.GetLeadingTrivia());\n\n var trailingTrivia = operand.GetTrailingTrivia()\n .Concat(closeParenToken.LeadingTrivia)\n .Where(t => !syntaxFacts.IsElastic(t))\n .Concat(closeParenToken.TrailingTrivia);\n\n var resultNode = operand\n .WithLeadingTrivia(leadingTrivia)\n .WithTrailingTrivia(trailingTrivia);\n\n // If there's no trivia between the original node and the tokens around it, then add\n // elastic markers so the formatting engine will spaces if necessary to keep things\n // parseable.\n if (resultNode.GetLeadingTrivia().Count == 0)\n {\n var previousToken = node.GetFirstToken().GetPreviousToken();\n if (previousToken.TrailingTrivia.Count == 0 &&\n syntaxFacts.IsWordOrNumber(previousToken) &&\n syntaxFacts.IsWordOrNumber(resultNode.GetFirstToken()))\n {\n resultNode = resultNode.WithPrependedLeadingTrivia(syntaxFacts.ElasticMarker);\n }\n }\n\n if (resultNode.GetTrailingTrivia().Count == 0)\n {\n var nextToken = node.GetLastToken().GetNextToken();\n if (nextToken.LeadingTrivia.Count == 0 &&\n syntaxFacts.IsWordOrNumber(nextToken) &&\n syntaxFacts.IsWordOrNumber(resultNode.GetLastToken()))\n {\n resultNode = resultNode.WithAppendedTrailingTrivia(syntaxFacts.ElasticMarker);\n }\n }\n\n return resultNode;\n }\n\n private static bool IsWordOrNumber(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => syntaxFacts.IsWord(token) || syntaxFacts.IsNumericLiteral(token);\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts service, SyntaxNode node)\n => service.SpansPreprocessorDirective(SpecializedCollections.SingletonEnumerable(node));\n\n public static bool SpansPreprocessorDirective(this ISyntaxFacts service, params SyntaxNode[] nodes)\n => service.SpansPreprocessorDirective(nodes);\n\n public static bool IsWhitespaceOrEndOfLineTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => syntaxFacts.IsWhitespaceTrivia(trivia) || syntaxFacts.IsEndOfLineTrivia(trivia);\n\n public static void GetPartsOfBinaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode left, out SyntaxNode right)\n => syntaxFacts.GetPartsOfBinaryExpression(node, out left, out _, out right);\n\n public static SyntaxNode GetPatternOfParenthesizedPattern(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfParenthesizedPattern(node, out _, out var pattern, out _);\n return pattern;\n }\n\n public static SyntaxToken GetOperatorTokenOfBinaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBinaryExpression(node, out _, out var token, out _);\n return token;\n }\n\n public static bool IsAnonymousOrLocalFunction(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n => syntaxFacts.IsAnonymousFunctionExpression(node) ||\n syntaxFacts.IsLocalFunctionStatement(node);\n\n public static SyntaxNode? GetExpressionOfElementAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfElementAccessExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxNode? GetArgumentListOfElementAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfElementAccessExpression(node, out _, out var argumentList);\n return argumentList;\n }\n\n public static SyntaxNode GetExpressionOfConditionalAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfConditionalAccessExpression(node, out var expression, out _);\n return expression;\n }\n\n public static SyntaxToken GetOperatorTokenOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfMemberAccessExpression(node, out _, out var operatorToken, out _);\n return operatorToken;\n }\n\n public static void GetPartsOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode expression, out SyntaxNode name)\n => syntaxFacts.GetPartsOfMemberAccessExpression(node, out expression, out _, out name);\n\n public static void GetPartsOfConditionalAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node, out SyntaxNode expression, out SyntaxNode whenNotNull)\n => syntaxFacts.GetPartsOfConditionalAccessExpression(node, out expression, out _, out whenNotNull);\n\n public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node)\n {\n // Span without AttributeLists\n // - No AttributeLists -> original .Span\n // - Some AttributeLists -> (first non-trivia/comment Token.Span.Begin, original.Span.End)\n // - We need to be mindful about comments due to:\n // // [Test1]\n // //Comment1\n // [||]object Property1 { get; set; }\n // the comment node being part of the next token's (`object`) leading trivia and not the AttributeList's node.\n // - In case only attribute is written we need to be careful to not to use next (unrelated) token as beginning current the node.\n var attributeList = syntaxFacts.GetAttributeLists(node);\n if (attributeList.Any())\n {\n var endOfAttributeLists = attributeList.Last().Span.End;\n var afterAttributesToken = root.FindTokenOnRightOfPosition(endOfAttributeLists);\n\n var endOfNode = node.Span.End;\n var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);\n\n return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);\n }\n\n return node.Span;\n }\n\n /// \n /// Gets the statement container node for the statement .\n /// \n /// The implementation.\n /// The statement.\n /// The statement container for .\n public static SyntaxNode? GetStatementContainer(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n for (var current = node; current is object; current = current.Parent)\n {\n if (syntaxFacts.IsStatementContainer(current.Parent))\n {\n return current.Parent;\n }\n }\n\n return null;\n }\n\n /// \n /// Similar to , this gets the containing\n /// expression that is actually a language expression and not just typed as an ExpressionSyntax for convenience.\n /// However, this goes beyond that that method in that if this expression is the RHS of a conditional access\n /// (i.e. a?.b()) it will also return the root of the conditional access expression tree.\n /// The intuition here is that this will give the topmost expression node that could realistically be\n /// replaced with any other expression. For example, with a?.b() technically .b() is an\n /// expression. But that cannot be replaced with something like (1 + 1) (as a?.(1 + 1) is not\n /// legal). However, in a?.b(), then a itself could be replaced with (1 + 1)?.b() to form\n /// a legal expression.\n /// \n public static SyntaxNode GetRootStandaloneExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n // First, make sure we're on a construct the language things is a standalone expression.\n var standalone = syntaxFacts.GetStandaloneExpression(node);\n\n // Then, if this is the RHS of a `?`, walk up to the top of that tree to get the final standalone expression.\n return syntaxFacts.GetRootConditionalAccessExpression(standalone) ?? standalone;\n }\n\n #region GetXXXOfYYY Members\n\n public static SyntaxNode? GetArgumentListOfInvocationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfInvocationExpression(node, out _, out var argumentList);\n return argumentList;\n }\n\n public static SyntaxNode? GetArgumentListOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out _, out var argumentList, out _);\n return argumentList;\n }\n\n public static SyntaxNode GetExpressionOfParenthesizedExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfParenthesizedExpression(node, out _, out var expression, out _);\n return expression;\n }\n\n public static SyntaxList GetImportsOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out _, out var imports, out _);\n return imports;\n }\n\n public static SyntaxList GetImportsOfCompilationUnit(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfCompilationUnit(node, out var imports, out _, out _);\n return imports;\n }\n\n public static SyntaxNode? GetInitializerOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out _, out _, out var initializer);\n return initializer;\n }\n\n public static SyntaxList GetMembersOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out _, out _, out var members);\n return members;\n }\n\n public static SyntaxList GetMembersOfCompilationUnit(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfCompilationUnit(node, out _, out _, out var members);\n return members;\n }\n\n public static SyntaxNode GetNameOfBaseNamespaceDeclaration(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfBaseNamespaceDeclaration(node, out var name, out _, out _);\n return name;\n }\n\n public static SyntaxNode GetNameOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfMemberAccessExpression(node, out _, out var name);\n return name;\n }\n\n public static SyntaxNode GetOperandOfPrefixUnaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfPrefixUnaryExpression(node, out _, out var operand);\n return operand;\n }\n\n public static SyntaxToken GetOperatorTokenOfPrefixUnaryExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfPrefixUnaryExpression(node, out var operatorToken, out _);\n return operatorToken;\n }\n\n public static SyntaxNode GetTypeOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n {\n syntaxFacts.GetPartsOfObjectCreationExpression(node, out var type, out _, out _);\n return type;\n }\n\n #endregion\n\n #region IsXXXOfYYY members\n\n public static bool IsExpressionOfAwaitExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsAwaitExpression(parent))\n return false;\n\n return node == syntaxFacts.GetExpressionOfAwaitExpression(parent);\n }\n\n public static bool IsExpressionOfInvocationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsInvocationExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfInvocationExpression(parent, out var expression, out _);\n return node == expression;\n }\n\n public static bool IsExpressionOfMemberAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsMemberAccessExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfMemberAccessExpression(parent, out var expression, out _);\n return node == expression;\n }\n\n public static bool IsRightOfQualifiedName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsQualifiedName(parent))\n return false;\n\n syntaxFacts.GetPartsOfQualifiedName(parent, out _, out _, out var right);\n return node == right;\n }\n\n public static bool IsTypeOfObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n {\n var parent = node?.Parent;\n if (!syntaxFacts.IsObjectCreationExpression(parent))\n return false;\n\n syntaxFacts.GetPartsOfObjectCreationExpression(parent, out var type, out _, out _);\n return type == node;\n }\n\n #endregion\n\n #region ISyntaxKinds forwarding methods\n\n #region trivia\n\n public static bool IsEndOfLineTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.EndOfLineTrivia;\n\n public static bool IsMultiLineCommentTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.MultiLineCommentTrivia;\n\n public static bool IsMultiLineDocCommentTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.MultiLineDocCommentTrivia;\n\n public static bool IsShebangDirectiveTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.ShebangDirectiveTrivia;\n\n public static bool IsSingleLineCommentTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.SingleLineCommentTrivia;\n\n public static bool IsSingleLineDocCommentTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.SingleLineDocCommentTrivia;\n\n public static bool IsWhitespaceTrivia(this ISyntaxFacts syntaxFacts, SyntaxTrivia trivia)\n => trivia.RawKind == syntaxFacts.SyntaxKinds.WhitespaceTrivia;\n\n public static bool IsSkippedTokensTrivia(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.SkippedTokensTrivia;\n\n #endregion\n\n #region keywords\n\n public static bool IsAwaitKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.AwaitKeyword;\n\n public static bool IsGlobalNamespaceKeyword(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.GlobalKeyword;\n\n #endregion\n\n #region literal tokens\n\n public static bool IsCharacterLiteral(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralToken;\n\n public static bool IsStringLiteral(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.StringLiteralToken;\n\n #endregion\n\n #region tokens\n\n public static bool IsIdentifier(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.IdentifierToken;\n\n public static bool IsHashToken(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.HashToken;\n\n public static bool IsInterpolatedStringTextToken(this ISyntaxFacts syntaxFacts, SyntaxToken token)\n => token.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringTextToken;\n\n #endregion\n\n #region names\n\n public static bool IsGenericName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.GenericName;\n\n public static bool IsIdentifierName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.IdentifierName;\n\n public static bool IsQualifiedName(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.QualifiedName;\n\n #endregion\n\n #region types\n\n public static bool IsTupleType(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TupleType;\n\n #endregion\n\n #region literal expressions\n\n public static bool IsCharacterLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralExpression;\n\n public static bool IsDefaultLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.DefaultLiteralExpression;\n\n public static bool IsFalseLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.FalseLiteralExpression;\n\n public static bool IsNumericLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.NumericLiteralExpression;\n\n public static bool IsNullLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.NullLiteralExpression;\n\n public static bool IsStringLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.StringLiteralExpression;\n\n public static bool IsTrueLiteralExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TrueLiteralExpression;\n\n #endregion\n\n #region expressions\n\n public static bool IsAwaitExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.AwaitExpression;\n\n public static bool IsBaseExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.BaseExpression;\n\n public static bool IsConditionalAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ConditionalAccessExpression;\n\n public static bool IsImplicitObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.ImplicitObjectCreationExpression;\n\n public static bool IsInterpolatedStringExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringExpression;\n\n public static bool IsInterpolation(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Interpolation;\n\n public static bool IsInterpolatedStringText(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringText;\n\n public static bool IsInvocationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.InvocationExpression;\n\n public static bool IsLogicalAndExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalAndExpression;\n\n public static bool IsLogicalOrExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalOrExpression;\n\n public static bool IsLogicalNotExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LogicalNotExpression;\n\n public static bool IsObjectCreationExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ObjectCreationExpression;\n\n public static bool IsParenthesizedExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ParenthesizedExpression;\n\n public static bool IsQueryExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.QueryExpression;\n\n public static bool IsSimpleMemberAccessExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.SimpleMemberAccessExpression;\n\n public static bool IsThisExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ThisExpression;\n\n public static bool IsThrowExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.ThrowExpression;\n\n public static bool IsTupleExpression(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TupleExpression;\n\n public static bool ContainsGlobalStatement(this ISyntaxFacts syntaxFacts, SyntaxNode node)\n => node.ChildNodes().Any(c => c.RawKind == syntaxFacts.SyntaxKinds.GlobalStatement);\n\n #endregion\n\n #region statements\n\n public static bool IsExpressionStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ExpressionStatement;\n\n public static bool IsForEachStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ForEachStatement;\n\n public static bool IsLocalDeclarationStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LocalDeclarationStatement;\n\n public static bool IsLocalFunctionStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node != null && node.RawKind == syntaxFacts.SyntaxKinds.LocalFunctionStatement;\n\n public static bool IsLockStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.LockStatement;\n\n public static bool IsReturnStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ReturnStatement;\n\n public static bool IsThrowStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ThrowStatement;\n\n public static bool IsUsingStatement(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.UsingStatement;\n\n #endregion\n\n #region members/declarations\n\n public static bool IsAttribute(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Attribute;\n\n public static bool IsClassDeclaration(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.ClassDeclaration;\n\n public static bool IsGlobalAttribute(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => syntaxFacts.IsGlobalAssemblyAttribute(node) || syntaxFacts.IsGlobalModuleAttribute(node);\n\n public static bool IsParameter(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.Parameter;\n\n public static bool IsTypeConstraint(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TypeConstraint;\n\n public static bool IsVariableDeclarator(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.VariableDeclarator;\n\n public static bool IsFieldDeclaration(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.FieldDeclaration;\n\n public static bool IsTypeArgumentList(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.TypeArgumentList;\n\n #endregion\n\n #region clauses\n\n public static bool IsEqualsValueClause(this ISyntaxFacts syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)\n => node?.RawKind == syntaxFacts.SyntaxKinds.EqualsValueClause;\n\n #endregion\n\n #endregion\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":211,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Collections.Immutable\nImports System.Text\nImports System.Threading\nImports Microsoft.CodeAnalysis\nImports Microsoft.CodeAnalysis.LanguageServices\nImports Microsoft.CodeAnalysis.PooledObjects\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports Microsoft.CodeAnalysis.VisualBasic.SyntaxFacts\nImports System.Diagnostics.CodeAnalysis\n\n#If CODE_STYLE Then\nImports Microsoft.CodeAnalysis.Internal.Editing\n#Else\nImports Microsoft.CodeAnalysis.Editing\n#End If\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices\n Friend Class VisualBasicSyntaxFacts\n Inherits AbstractSyntaxFacts\n Implements ISyntaxFacts\n\n Public Shared ReadOnly Property Instance As New VisualBasicSyntaxFacts\n\n Protected Sub New()\n End Sub\n\n Public ReadOnly Property IsCaseSensitive As Boolean Implements ISyntaxFacts.IsCaseSensitive\n Get\n Return False\n End Get\n End Property\n\n Public ReadOnly Property StringComparer As StringComparer Implements ISyntaxFacts.StringComparer\n Get\n Return CaseInsensitiveComparison.Comparer\n End Get\n End Property\n\n Public ReadOnly Property ElasticMarker As SyntaxTrivia Implements ISyntaxFacts.ElasticMarker\n Get\n Return SyntaxFactory.ElasticMarker\n End Get\n End Property\n\n Public ReadOnly Property ElasticCarriageReturnLineFeed As SyntaxTrivia Implements ISyntaxFacts.ElasticCarriageReturnLineFeed\n Get\n Return SyntaxFactory.ElasticCarriageReturnLineFeed\n End Get\n End Property\n\n Public Overrides ReadOnly Property SyntaxKinds As ISyntaxKinds = VisualBasicSyntaxKinds.Instance Implements ISyntaxFacts.SyntaxKinds\n\n Public Function SupportsIndexingInitializer(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsIndexingInitializer\n Return False\n End Function\n\n Public Function SupportsThrowExpression(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsThrowExpression\n Return False\n End Function\n\n Public Function SupportsLocalFunctionDeclaration(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsLocalFunctionDeclaration\n Return False\n End Function\n\n Public Function SupportsRecord(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsRecord\n Return False\n End Function\n\n Public Function SupportsRecordStruct(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsRecordStruct\n Return False\n End Function\n\n Public Function ParseToken(text As String) As SyntaxToken Implements ISyntaxFacts.ParseToken\n Return SyntaxFactory.ParseToken(text, startStatement:=True)\n End Function\n\n Public Function ParseLeadingTrivia(text As String) As SyntaxTriviaList Implements ISyntaxFacts.ParseLeadingTrivia\n Return SyntaxFactory.ParseLeadingTrivia(text)\n End Function\n\n Public Function EscapeIdentifier(identifier As String) As String Implements ISyntaxFacts.EscapeIdentifier\n Dim keywordKind = SyntaxFacts.GetKeywordKind(identifier)\n Dim needsEscaping = keywordKind <> SyntaxKind.None\n\n Return If(needsEscaping, \"[\" & identifier & \"]\", identifier)\n End Function\n\n Public Function IsVerbatimIdentifier(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsVerbatimIdentifier\n Return False\n End Function\n\n Public Function IsOperator(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsOperator\n Return (IsUnaryExpressionOperatorToken(CType(token.Kind, SyntaxKind)) AndAlso (TypeOf token.Parent Is UnaryExpressionSyntax OrElse TypeOf token.Parent Is OperatorStatementSyntax)) OrElse\n (IsBinaryExpressionOperatorToken(CType(token.Kind, SyntaxKind)) AndAlso (TypeOf token.Parent Is BinaryExpressionSyntax OrElse TypeOf token.Parent Is OperatorStatementSyntax))\n End Function\n\n Public Function IsContextualKeyword(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsContextualKeyword\n Return token.IsContextualKeyword()\n End Function\n\n Public Function IsReservedKeyword(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsReservedKeyword\n Return token.IsReservedKeyword()\n End Function\n\n Public Function IsPreprocessorKeyword(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsPreprocessorKeyword\n Return token.IsPreprocessorKeyword()\n End Function\n\n Public Function IsPreProcessorDirectiveContext(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.IsPreProcessorDirectiveContext\n Return syntaxTree.IsInPreprocessorDirectiveContext(position, cancellationToken)\n End Function\n\n Public Function TryGetCorrespondingOpenBrace(token As SyntaxToken, ByRef openBrace As SyntaxToken) As Boolean Implements ISyntaxFacts.TryGetCorrespondingOpenBrace\n\n If token.Kind = SyntaxKind.CloseBraceToken Then\n Dim tuples = token.Parent.GetBraces()\n openBrace = tuples.openBrace\n Return openBrace.Kind = SyntaxKind.OpenBraceToken\n End If\n\n Return False\n End Function\n\n Public Function IsEntirelyWithinStringOrCharOrNumericLiteral(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.IsEntirelyWithinStringOrCharOrNumericLiteral\n If syntaxTree Is Nothing Then\n Return False\n End If\n\n Return syntaxTree.IsEntirelyWithinStringOrCharOrNumericLiteral(position, cancellationToken)\n End Function\n\n Public Function IsDirective(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDirective\n Return TypeOf node Is DirectiveTriviaSyntax\n End Function\n\n Public Function TryGetExternalSourceInfo(node As SyntaxNode, ByRef info As ExternalSourceInfo) As Boolean Implements ISyntaxFacts.TryGetExternalSourceInfo\n Select Case node.Kind\n Case SyntaxKind.ExternalSourceDirectiveTrivia\n info = New ExternalSourceInfo(CInt(DirectCast(node, ExternalSourceDirectiveTriviaSyntax).LineStart.Value), False)\n Return True\n\n Case SyntaxKind.EndExternalSourceDirectiveTrivia\n info = New ExternalSourceInfo(Nothing, True)\n Return True\n End Select\n\n Return False\n End Function\n\n Public Function IsDeclarationExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeclarationExpression\n ' VB doesn't support declaration expressions\n Return False\n End Function\n\n Public Function IsAttributeName(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAttributeName\n Return node.IsParentKind(SyntaxKind.Attribute) AndAlso\n DirectCast(node.Parent, AttributeSyntax).Name Is node\n End Function\n\n Public Function IsNameOfSimpleMemberAccessExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNameOfSimpleMemberAccessExpression\n Dim vbNode = TryCast(node, ExpressionSyntax)\n Return vbNode IsNot Nothing AndAlso vbNode.IsSimpleMemberAccessExpressionName()\n End Function\n\n Public Function IsNameOfAnyMemberAccessExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNameOfAnyMemberAccessExpression\n Dim memberAccess = TryCast(node?.Parent, MemberAccessExpressionSyntax)\n Return memberAccess IsNot Nothing AndAlso memberAccess.Name Is node\n End Function\n\n Public Function GetStandaloneExpression(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetStandaloneExpression\n Return SyntaxFactory.GetStandaloneExpression(TryCast(node, ExpressionSyntax))\n End Function\n\n Public Function GetRootConditionalAccessExpression(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetRootConditionalAccessExpression\n Return TryCast(node, ExpressionSyntax).GetRootConditionalAccessExpression()\n End Function\n\n Public Function IsNamedArgument(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNamedArgument\n Dim arg = TryCast(node, SimpleArgumentSyntax)\n Return arg?.NameColonEquals IsNot Nothing\n End Function\n\n Public Function IsNameOfNamedArgument(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNameOfNamedArgument\n Return node.CheckParent(Of SimpleArgumentSyntax)(Function(p) p.IsNamed AndAlso p.NameColonEquals.Name Is node)\n End Function\n\n Public Function GetNameOfParameter(node As SyntaxNode) As SyntaxToken? Implements ISyntaxFacts.GetNameOfParameter\n Return DirectCast(node, ParameterSyntax).Identifier?.Identifier\n End Function\n\n Public Function GetDefaultOfParameter(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetDefaultOfParameter\n Return DirectCast(node, ParameterSyntax).Default\n End Function\n\n Public Function GetParameterList(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetParameterList\n Return node.GetParameterList()\n End Function\n\n Public Function IsParameterList(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsParameterList\n Return node.IsKind(SyntaxKind.ParameterList)\n End Function\n\n Public Function ISyntaxFacts_HasIncompleteParentMember(node As SyntaxNode) As Boolean Implements ISyntaxFacts.HasIncompleteParentMember\n Return HasIncompleteParentMember(node)\n End Function\n\n Public Function GetIdentifierOfGenericName(genericName As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfGenericName\n Return DirectCast(genericName, GenericNameSyntax).Identifier\n End Function\n\n Public Function IsUsingDirectiveName(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsUsingDirectiveName\n Return node.IsParentKind(SyntaxKind.SimpleImportsClause) AndAlso\n DirectCast(node.Parent, SimpleImportsClauseSyntax).Name Is node\n End Function\n\n Public Function IsDeconstructionAssignment(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeconstructionAssignment\n Return False\n End Function\n\n Public Function IsDeconstructionForEachStatement(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeconstructionForEachStatement\n Return False\n End Function\n\n Public Function IsStatement(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsStatement\n Return TypeOf node Is StatementSyntax\n End Function\n\n Public Function IsExecutableStatement(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsExecutableStatement\n Return TypeOf node Is ExecutableStatementSyntax\n End Function\n\n Public Function IsMethodBody(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMethodBody\n Return TypeOf node Is MethodBlockBaseSyntax\n End Function\n\n Public Function GetExpressionOfReturnStatement(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfReturnStatement\n Return DirectCast(node, ReturnStatementSyntax).Expression\n End Function\n\n Public Function IsThisConstructorInitializer(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsThisConstructorInitializer\n If TypeOf token.Parent Is IdentifierNameSyntax AndAlso token.HasMatchingText(SyntaxKind.NewKeyword) Then\n Dim memberAccess = TryCast(token.Parent.Parent, MemberAccessExpressionSyntax)\n Return memberAccess.IsThisConstructorInitializer()\n End If\n\n Return False\n End Function\n\n Public Function IsBaseConstructorInitializer(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsBaseConstructorInitializer\n If TypeOf token.Parent Is IdentifierNameSyntax AndAlso token.HasMatchingText(SyntaxKind.NewKeyword) Then\n Dim memberAccess = TryCast(token.Parent.Parent, MemberAccessExpressionSyntax)\n Return memberAccess.IsBaseConstructorInitializer()\n End If\n\n Return False\n End Function\n\n Public Function IsQueryKeyword(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsQueryKeyword\n Select Case token.Kind()\n Case _\n SyntaxKind.JoinKeyword,\n SyntaxKind.IntoKeyword,\n SyntaxKind.AggregateKeyword,\n SyntaxKind.DistinctKeyword,\n SyntaxKind.SkipKeyword,\n SyntaxKind.TakeKeyword,\n SyntaxKind.LetKeyword,\n SyntaxKind.ByKeyword,\n SyntaxKind.OrderKeyword,\n SyntaxKind.WhereKeyword,\n SyntaxKind.OnKeyword,\n SyntaxKind.FromKeyword,\n SyntaxKind.WhileKeyword,\n SyntaxKind.SelectKeyword\n Return TypeOf token.Parent Is QueryClauseSyntax\n Case SyntaxKind.GroupKeyword\n Return (TypeOf token.Parent Is QueryClauseSyntax) OrElse (token.Parent.IsKind(SyntaxKind.GroupAggregation))\n Case SyntaxKind.EqualsKeyword\n Return TypeOf token.Parent Is JoinConditionSyntax\n Case SyntaxKind.AscendingKeyword, SyntaxKind.DescendingKeyword\n Return TypeOf token.Parent Is OrderingSyntax\n Case SyntaxKind.InKeyword\n Return TypeOf token.Parent Is CollectionRangeVariableSyntax\n Case Else\n Return False\n End Select\n End Function\n\n Public Function IsPredefinedType(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsPredefinedType\n Dim actualType As PredefinedType = PredefinedType.None\n Return TryGetPredefinedType(token, actualType) AndAlso actualType <> PredefinedType.None\n End Function\n\n Public Function IsPredefinedType(token As SyntaxToken, type As PredefinedType) As Boolean Implements ISyntaxFacts.IsPredefinedType\n Dim actualType As PredefinedType = PredefinedType.None\n Return TryGetPredefinedType(token, actualType) AndAlso actualType = type\n End Function\n\n Public Function TryGetPredefinedType(token As SyntaxToken, ByRef type As PredefinedType) As Boolean Implements ISyntaxFacts.TryGetPredefinedType\n type = GetPredefinedType(token)\n Return type <> PredefinedType.None\n End Function\n\n Private Shared Function GetPredefinedType(token As SyntaxToken) As PredefinedType\n Select Case token.Kind\n Case SyntaxKind.BooleanKeyword\n Return PredefinedType.Boolean\n Case SyntaxKind.ByteKeyword\n Return PredefinedType.Byte\n Case SyntaxKind.SByteKeyword\n Return PredefinedType.SByte\n Case SyntaxKind.IntegerKeyword\n Return PredefinedType.Int32\n Case SyntaxKind.UIntegerKeyword\n Return PredefinedType.UInt32\n Case SyntaxKind.ShortKeyword\n Return PredefinedType.Int16\n Case SyntaxKind.UShortKeyword\n Return PredefinedType.UInt16\n Case SyntaxKind.LongKeyword\n Return PredefinedType.Int64\n Case SyntaxKind.ULongKeyword\n Return PredefinedType.UInt64\n Case SyntaxKind.SingleKeyword\n Return PredefinedType.Single\n Case SyntaxKind.DoubleKeyword\n Return PredefinedType.Double\n Case SyntaxKind.DecimalKeyword\n Return PredefinedType.Decimal\n Case SyntaxKind.StringKeyword\n Return PredefinedType.String\n Case SyntaxKind.CharKeyword\n Return PredefinedType.Char\n Case SyntaxKind.ObjectKeyword\n Return PredefinedType.Object\n Case SyntaxKind.DateKeyword\n Return PredefinedType.DateTime\n Case Else\n Return PredefinedType.None\n End Select\n End Function\n\n Public Function IsPredefinedOperator(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsPredefinedOperator\n Dim actualOp As PredefinedOperator = PredefinedOperator.None\n Return TryGetPredefinedOperator(token, actualOp) AndAlso actualOp <> PredefinedOperator.None\n End Function\n\n Public Function IsPredefinedOperator(token As SyntaxToken, op As PredefinedOperator) As Boolean Implements ISyntaxFacts.IsPredefinedOperator\n Dim actualOp As PredefinedOperator = PredefinedOperator.None\n Return TryGetPredefinedOperator(token, actualOp) AndAlso actualOp = op\n End Function\n\n Public Function TryGetPredefinedOperator(token As SyntaxToken, ByRef op As PredefinedOperator) As Boolean Implements ISyntaxFacts.TryGetPredefinedOperator\n op = GetPredefinedOperator(token)\n Return op <> PredefinedOperator.None\n End Function\n\n Private Shared Function GetPredefinedOperator(token As SyntaxToken) As PredefinedOperator\n Select Case token.Kind\n Case SyntaxKind.PlusToken, SyntaxKind.PlusEqualsToken\n Return PredefinedOperator.Addition\n\n Case SyntaxKind.MinusToken, SyntaxKind.MinusEqualsToken\n Return PredefinedOperator.Subtraction\n\n Case SyntaxKind.AndKeyword, SyntaxKind.AndAlsoKeyword\n Return PredefinedOperator.BitwiseAnd\n\n Case SyntaxKind.OrKeyword, SyntaxKind.OrElseKeyword\n Return PredefinedOperator.BitwiseOr\n\n Case SyntaxKind.AmpersandToken, SyntaxKind.AmpersandEqualsToken\n Return PredefinedOperator.Concatenate\n\n Case SyntaxKind.SlashToken, SyntaxKind.SlashEqualsToken\n Return PredefinedOperator.Division\n\n Case SyntaxKind.EqualsToken\n Return PredefinedOperator.Equality\n\n Case SyntaxKind.XorKeyword\n Return PredefinedOperator.ExclusiveOr\n\n Case SyntaxKind.CaretToken, SyntaxKind.CaretEqualsToken\n Return PredefinedOperator.Exponent\n\n Case SyntaxKind.GreaterThanToken\n Return PredefinedOperator.GreaterThan\n\n Case SyntaxKind.GreaterThanEqualsToken\n Return PredefinedOperator.GreaterThanOrEqual\n\n Case SyntaxKind.LessThanGreaterThanToken\n Return PredefinedOperator.Inequality\n\n Case SyntaxKind.BackslashToken, SyntaxKind.BackslashEqualsToken\n Return PredefinedOperator.IntegerDivision\n\n Case SyntaxKind.LessThanLessThanToken, SyntaxKind.LessThanLessThanEqualsToken\n Return PredefinedOperator.LeftShift\n\n Case SyntaxKind.LessThanToken\n Return PredefinedOperator.LessThan\n\n Case SyntaxKind.LessThanEqualsToken\n Return PredefinedOperator.LessThanOrEqual\n\n Case SyntaxKind.LikeKeyword\n Return PredefinedOperator.Like\n\n Case SyntaxKind.NotKeyword\n Return PredefinedOperator.Complement\n\n Case SyntaxKind.ModKeyword\n Return PredefinedOperator.Modulus\n\n Case SyntaxKind.AsteriskToken, SyntaxKind.AsteriskEqualsToken\n Return PredefinedOperator.Multiplication\n\n Case SyntaxKind.GreaterThanGreaterThanToken, SyntaxKind.GreaterThanGreaterThanEqualsToken\n Return PredefinedOperator.RightShift\n\n Case Else\n Return PredefinedOperator.None\n End Select\n End Function\n\n Public Function GetText(kind As Integer) As String Implements ISyntaxFacts.GetText\n Return SyntaxFacts.GetText(CType(kind, SyntaxKind))\n End Function\n\n Public Function IsIdentifierPartCharacter(c As Char) As Boolean Implements ISyntaxFacts.IsIdentifierPartCharacter\n Return SyntaxFacts.IsIdentifierPartCharacter(c)\n End Function\n\n Public Function IsIdentifierStartCharacter(c As Char) As Boolean Implements ISyntaxFacts.IsIdentifierStartCharacter\n Return SyntaxFacts.IsIdentifierStartCharacter(c)\n End Function\n\n Public Function IsIdentifierEscapeCharacter(c As Char) As Boolean Implements ISyntaxFacts.IsIdentifierEscapeCharacter\n Return c = \"[\"c OrElse c = \"]\"c\n End Function\n\n Public Function IsValidIdentifier(identifier As String) As Boolean Implements ISyntaxFacts.IsValidIdentifier\n Dim token = SyntaxFactory.ParseToken(identifier)\n ' TODO: There is no way to get the diagnostics to see if any are actually errors?\n Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length\n End Function\n\n Public Function IsVerbatimIdentifier(identifier As String) As Boolean Implements ISyntaxFacts.IsVerbatimIdentifier\n Return IsValidIdentifier(identifier) AndAlso MakeHalfWidthIdentifier(identifier.First()) = \"[\" AndAlso MakeHalfWidthIdentifier(identifier.Last()) = \"]\"\n End Function\n\n Public Function IsTypeCharacter(c As Char) As Boolean Implements ISyntaxFacts.IsTypeCharacter\n Return c = \"%\"c OrElse\n c = \"&\"c OrElse\n c = \"@\"c OrElse\n c = \"!\"c OrElse\n c = \"#\"c OrElse\n c = \"$\"c\n End Function\n\n Public Function IsStartOfUnicodeEscapeSequence(c As Char) As Boolean Implements ISyntaxFacts.IsStartOfUnicodeEscapeSequence\n Return False ' VB does not support identifiers with escaped unicode characters\n End Function\n\n Public Function IsLiteral(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsLiteral\n Select Case token.Kind()\n Case _\n SyntaxKind.IntegerLiteralToken,\n SyntaxKind.CharacterLiteralToken,\n SyntaxKind.DecimalLiteralToken,\n SyntaxKind.FloatingLiteralToken,\n SyntaxKind.DateLiteralToken,\n SyntaxKind.StringLiteralToken,\n SyntaxKind.DollarSignDoubleQuoteToken,\n SyntaxKind.DoubleQuoteToken,\n SyntaxKind.InterpolatedStringTextToken,\n SyntaxKind.TrueKeyword,\n SyntaxKind.FalseKeyword,\n SyntaxKind.NothingKeyword\n Return True\n End Select\n\n Return False\n End Function\n\n Public Function IsStringLiteralOrInterpolatedStringLiteral(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsStringLiteralOrInterpolatedStringLiteral\n Return token.IsKind(SyntaxKind.StringLiteralToken, SyntaxKind.InterpolatedStringTextToken)\n End Function\n\n Public Function IsBindableToken(token As Microsoft.CodeAnalysis.SyntaxToken) As Boolean Implements ISyntaxFacts.IsBindableToken\n Return Me.IsWord(token) OrElse\n Me.IsLiteral(token) OrElse\n Me.IsOperator(token)\n End Function\n\n Public Function IsPointerMemberAccessExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsPointerMemberAccessExpression\n Return False\n End Function\n\n Public Sub GetNameAndArityOfSimpleName(node As SyntaxNode, ByRef name As String, ByRef arity As Integer) Implements ISyntaxFacts.GetNameAndArityOfSimpleName\n Dim simpleName = DirectCast(node, SimpleNameSyntax)\n name = simpleName.Identifier.ValueText\n arity = simpleName.Arity\n End Sub\n\n Public Function LooksGeneric(name As SyntaxNode) As Boolean Implements ISyntaxFacts.LooksGeneric\n Return name.IsKind(SyntaxKind.GenericName)\n End Function\n\n Public Function GetExpressionOfMemberAccessExpression(node As SyntaxNode, Optional allowImplicitTarget As Boolean = False) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfMemberAccessExpression\n Return TryCast(node, MemberAccessExpressionSyntax)?.GetExpressionOfMemberAccessExpression(allowImplicitTarget)\n End Function\n\n Public Function GetTargetOfMemberBinding(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetTargetOfMemberBinding\n ' Member bindings are a C# concept.\n Return Nothing\n End Function\n\n Public Function GetNameOfMemberBindingExpression(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetNameOfMemberBindingExpression\n ' Member bindings are a C# concept.\n Return Nothing\n End Function\n\n Public Sub GetPartsOfElementAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef argumentList As SyntaxNode) Implements ISyntaxFacts.GetPartsOfElementAccessExpression\n Dim invocation = TryCast(node, InvocationExpressionSyntax)\n If invocation IsNot Nothing Then\n expression = invocation?.Expression\n argumentList = invocation?.ArgumentList\n Return\n End If\n\n If node.Kind() = SyntaxKind.DictionaryAccessExpression Then\n GetPartsOfMemberAccessExpression(node, expression, argumentList)\n Return\n End If\n\n Throw ExceptionUtilities.UnexpectedValue(node.Kind())\n End Sub\n\n Public Function GetExpressionOfInterpolation(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfInterpolation\n Return DirectCast(node, InterpolationSyntax).Expression\n End Function\n\n Public Function IsInNamespaceOrTypeContext(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsInNamespaceOrTypeContext\n Return SyntaxFacts.IsInNamespaceOrTypeContext(node)\n End Function\n\n Public Function IsBaseTypeList(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsBaseTypeList\n Return TryCast(node, InheritsOrImplementsStatementSyntax) IsNot Nothing\n End Function\n\n Public Function IsInStaticContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean Implements ISyntaxFacts.IsInStaticContext\n Return node.IsInStaticContext()\n End Function\n\n Public Function GetExpressionOfArgument(node As Microsoft.CodeAnalysis.SyntaxNode) As Microsoft.CodeAnalysis.SyntaxNode Implements ISyntaxFacts.GetExpressionOfArgument\n Return DirectCast(node, ArgumentSyntax).GetArgumentExpression()\n End Function\n\n Public Function GetRefKindOfArgument(node As Microsoft.CodeAnalysis.SyntaxNode) As Microsoft.CodeAnalysis.RefKind Implements ISyntaxFacts.GetRefKindOfArgument\n ' TODO(cyrusn): Consider the method this argument is passed to, to determine this.\n Return RefKind.None\n End Function\n\n Public Function IsArgument(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsArgument\n Return TypeOf node Is ArgumentSyntax\n End Function\n\n Public Function IsSimpleArgument(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsSimpleArgument\n Dim argument = TryCast(node, ArgumentSyntax)\n Return argument IsNot Nothing AndAlso Not argument.IsNamed AndAlso Not argument.IsOmitted\n End Function\n\n Public Function IsInConstantContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean Implements ISyntaxFacts.IsInConstantContext\n Return node.IsInConstantContext()\n End Function\n\n Public Function IsInConstructor(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean Implements ISyntaxFacts.IsInConstructor\n Return node.GetAncestors(Of StatementSyntax).Any(Function(s) s.Kind = SyntaxKind.ConstructorBlock)\n End Function\n\n Public Function IsUnsafeContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean Implements ISyntaxFacts.IsUnsafeContext\n Return False\n End Function\n\n Public Function GetNameOfAttribute(node As SyntaxNode) As Microsoft.CodeAnalysis.SyntaxNode Implements ISyntaxFacts.GetNameOfAttribute\n Return DirectCast(node, AttributeSyntax).Name\n End Function\n\n Public Function IsAttributeNamedArgumentIdentifier(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAttributeNamedArgumentIdentifier\n Dim identifierName = TryCast(node, IdentifierNameSyntax)\n Return identifierName.IsParentKind(SyntaxKind.NameColonEquals) AndAlso\n identifierName.Parent.IsParentKind(SyntaxKind.SimpleArgument) AndAlso\n identifierName.Parent.Parent.IsParentKind(SyntaxKind.ArgumentList) AndAlso\n identifierName.Parent.Parent.Parent.IsParentKind(SyntaxKind.Attribute)\n End Function\n\n Public Function GetContainingTypeDeclaration(root As SyntaxNode, position As Integer) As SyntaxNode Implements ISyntaxFacts.GetContainingTypeDeclaration\n If root Is Nothing Then\n Throw New ArgumentNullException(NameOf(root))\n End If\n\n If position < 0 OrElse position > root.Span.End Then\n Throw New ArgumentOutOfRangeException(NameOf(position))\n End If\n\n Return root.\n FindToken(position).\n GetAncestors(Of SyntaxNode)().\n FirstOrDefault(Function(n) TypeOf n Is TypeBlockSyntax OrElse TypeOf n Is DelegateStatementSyntax)\n End Function\n\n Public Function GetContainingVariableDeclaratorOfFieldDeclaration(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetContainingVariableDeclaratorOfFieldDeclaration\n If node Is Nothing Then\n Throw New ArgumentNullException(NameOf(node))\n End If\n\n Dim parent = node.Parent\n\n While node IsNot Nothing\n If node.Kind = SyntaxKind.VariableDeclarator AndAlso node.IsParentKind(SyntaxKind.FieldDeclaration) Then\n Return node\n End If\n\n node = node.Parent\n End While\n\n Return Nothing\n End Function\n\n Public Function IsMemberInitializerNamedAssignmentIdentifier(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMemberInitializerNamedAssignmentIdentifier\n Dim unused As SyntaxNode = Nothing\n Return IsMemberInitializerNamedAssignmentIdentifier(node, unused)\n End Function\n\n Public Function IsMemberInitializerNamedAssignmentIdentifier(\n node As SyntaxNode,\n ByRef initializedInstance As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMemberInitializerNamedAssignmentIdentifier\n\n Dim identifier = TryCast(node, IdentifierNameSyntax)\n If identifier?.IsChildNode(Of NamedFieldInitializerSyntax)(Function(n) n.Name) Then\n ' .parent is the NamedField.\n ' .parent.parent is the ObjectInitializer.\n ' .parent.parent.parent will be the ObjectCreationExpression.\n initializedInstance = identifier.Parent.Parent.Parent\n Return True\n End If\n\n Return False\n End Function\n\n Public Function IsNameOfSubpattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNameOfSubpattern\n Return False\n End Function\n\n Public Function IsPropertyPatternClause(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsPropertyPatternClause\n Return False\n End Function\n\n Public Function IsElementAccessExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsElementAccessExpression\n ' VB doesn't have a specialized node for element access. Instead, it just uses an\n ' invocation expression or dictionary access expression.\n Return node.Kind = SyntaxKind.InvocationExpression OrElse node.Kind = SyntaxKind.DictionaryAccessExpression\n End Function\n\n Public Function IsIndexerMemberCRef(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsIndexerMemberCRef\n Return False\n End Function\n\n Public Function GetContainingMemberDeclaration(root As SyntaxNode, position As Integer, Optional useFullSpan As Boolean = True) As SyntaxNode Implements ISyntaxFacts.GetContainingMemberDeclaration\n Contract.ThrowIfNull(root, NameOf(root))\n Contract.ThrowIfTrue(position < 0 OrElse position > root.FullSpan.End, NameOf(position))\n\n Dim [end] = root.FullSpan.End\n If [end] = 0 Then\n ' empty file\n Return Nothing\n End If\n\n ' make sure position doesn't touch end of root\n position = Math.Min(position, [end] - 1)\n\n Dim node = root.FindToken(position).Parent\n While node IsNot Nothing\n If useFullSpan OrElse node.Span.Contains(position) Then\n\n If TypeOf node Is MethodBlockBaseSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is MethodBaseSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return node\n End If\n\n If TypeOf node Is PropertyStatementSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is EventStatementSyntax AndAlso Not TypeOf node.Parent Is EventBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is PropertyBlockSyntax OrElse\n TypeOf node Is TypeBlockSyntax OrElse\n TypeOf node Is EnumBlockSyntax OrElse\n TypeOf node Is NamespaceBlockSyntax OrElse\n TypeOf node Is EventBlockSyntax OrElse\n TypeOf node Is FieldDeclarationSyntax Then\n Return node\n End If\n End If\n\n node = node.Parent\n End While\n\n Return Nothing\n End Function\n\n Public Function IsMethodLevelMember(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMethodLevelMember\n\n ' Note: Derived types of MethodBaseSyntax are expanded explicitly, since PropertyStatementSyntax and\n ' EventStatementSyntax will NOT be parented by MethodBlockBaseSyntax. Additionally, there are things\n ' like AccessorStatementSyntax and DelegateStatementSyntax that we never want to tread as method level\n ' members.\n\n If TypeOf node Is MethodStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is SubNewStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is OperatorStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is PropertyStatementSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return True\n End If\n\n If TypeOf node Is EventStatementSyntax AndAlso Not TypeOf node.Parent Is EventBlockSyntax Then\n Return True\n End If\n\n If TypeOf node Is DeclareStatementSyntax Then\n Return True\n End If\n\n Return TypeOf node Is ConstructorBlockSyntax OrElse\n TypeOf node Is MethodBlockSyntax OrElse\n TypeOf node Is OperatorBlockSyntax OrElse\n TypeOf node Is EventBlockSyntax OrElse\n TypeOf node Is PropertyBlockSyntax OrElse\n TypeOf node Is EnumMemberDeclarationSyntax OrElse\n TypeOf node Is FieldDeclarationSyntax\n End Function\n\n Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding\n Dim member = GetContainingMemberDeclaration(node, node.SpanStart)\n If member Is Nothing Then\n Return Nothing\n End If\n\n ' TODO: currently we only support method for now\n Dim method = TryCast(member, MethodBlockBaseSyntax)\n If method IsNot Nothing Then\n If method.BlockStatement Is Nothing OrElse method.EndBlockStatement Is Nothing Then\n Return Nothing\n End If\n\n ' We don't want to include the BlockStatement or any trailing trivia up to and including its statement\n ' terminator in the span. Instead, we use the start of the first statement's leading trivia (if any) up\n ' to the start of the EndBlockStatement. If there aren't any statements in the block, we use the start\n ' of the EndBlockStatements leading trivia.\n\n Dim firstStatement = method.Statements.FirstOrDefault()\n Dim spanStart = If(firstStatement IsNot Nothing,\n firstStatement.FullSpan.Start,\n method.EndBlockStatement.FullSpan.Start)\n\n Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart)\n End If\n\n Return Nothing\n End Function\n\n Public Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean Implements ISyntaxFacts.ContainsInMemberBody\n Dim method = TryCast(node, MethodBlockBaseSyntax)\n If method IsNot Nothing Then\n Return method.Statements.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan(method.Statements), span)\n End If\n\n Dim [event] = TryCast(node, EventBlockSyntax)\n If [event] IsNot Nothing Then\n Return [event].Accessors.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan([event].Accessors), span)\n End If\n\n Dim [property] = TryCast(node, PropertyBlockSyntax)\n If [property] IsNot Nothing Then\n Return [property].Accessors.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan([property].Accessors), span)\n End If\n\n Dim field = TryCast(node, FieldDeclarationSyntax)\n If field IsNot Nothing Then\n Return field.Declarators.Count > 0 AndAlso ContainsExclusively(GetSeparatedSyntaxListSpan(field.Declarators), span)\n End If\n\n Dim [enum] = TryCast(node, EnumMemberDeclarationSyntax)\n If [enum] IsNot Nothing Then\n Return [enum].Initializer IsNot Nothing AndAlso ContainsExclusively([enum].Initializer.Span, span)\n End If\n\n Dim propStatement = TryCast(node, PropertyStatementSyntax)\n If propStatement IsNot Nothing Then\n Return propStatement.Initializer IsNot Nothing AndAlso ContainsExclusively(propStatement.Initializer.Span, span)\n End If\n\n Return False\n End Function\n\n Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean\n If innerSpan.IsEmpty Then\n Return outerSpan.Contains(innerSpan.Start)\n End If\n\n Return outerSpan.Contains(innerSpan)\n End Function\n\n Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan\n Debug.Assert(list.Count > 0)\n Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)\n End Function\n\n Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan\n Debug.Assert(list.Count > 0)\n Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)\n End Function\n\n Public Function GetTopLevelAndMethodLevelMembers(root As SyntaxNode) As List(Of SyntaxNode) Implements ISyntaxFacts.GetTopLevelAndMethodLevelMembers\n Dim list = New List(Of SyntaxNode)()\n AppendMembers(root, list, topLevel:=True, methodLevel:=True)\n Return list\n End Function\n\n Public Function GetMethodLevelMembers(root As SyntaxNode) As List(Of SyntaxNode) Implements ISyntaxFacts.GetMethodLevelMembers\n Dim list = New List(Of SyntaxNode)()\n AppendMembers(root, list, topLevel:=False, methodLevel:=True)\n Return list\n End Function\n\n Public Function GetMembersOfTypeDeclaration(typeDeclaration As SyntaxNode) As SyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetMembersOfTypeDeclaration\n Return DirectCast(typeDeclaration, TypeBlockSyntax).Members\n End Function\n\n Public Function IsTopLevelNodeWithMembers(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsTopLevelNodeWithMembers\n Return TypeOf node Is NamespaceBlockSyntax OrElse\n TypeOf node Is TypeBlockSyntax OrElse\n TypeOf node Is EnumBlockSyntax\n End Function\n\n Private Const s_dotToken As String = \".\"\n\n Public Function GetDisplayName(node As SyntaxNode, options As DisplayNameOptions, Optional rootNamespace As String = Nothing) As String Implements ISyntaxFacts.GetDisplayName\n If node Is Nothing Then\n Return String.Empty\n End If\n\n Dim pooled = PooledStringBuilder.GetInstance()\n Dim builder = pooled.Builder\n\n ' member keyword (if any)\n Dim memberDeclaration = TryCast(node, DeclarationStatementSyntax)\n If (options And DisplayNameOptions.IncludeMemberKeyword) <> 0 Then\n Dim keywordToken = memberDeclaration.GetMemberKeywordToken()\n If keywordToken <> Nothing AndAlso Not keywordToken.IsMissing Then\n builder.Append(keywordToken.Text)\n builder.Append(\" \"c)\n End If\n End If\n\n Dim names = ArrayBuilder(Of String).GetInstance()\n ' containing type(s)\n Dim parent = node.Parent\n While TypeOf parent Is TypeBlockSyntax\n names.Push(GetName(parent, options, containsGlobalKeyword:=False))\n parent = parent.Parent\n End While\n\n If (options And DisplayNameOptions.IncludeNamespaces) <> 0 Then\n ' containing namespace(s) in source (if any)\n Dim containsGlobalKeyword As Boolean = False\n While parent IsNot Nothing AndAlso parent.Kind() = SyntaxKind.NamespaceBlock\n names.Push(GetName(parent, options, containsGlobalKeyword))\n parent = parent.Parent\n End While\n ' root namespace (if any)\n If Not containsGlobalKeyword AndAlso Not String.IsNullOrEmpty(rootNamespace) Then\n builder.Append(rootNamespace)\n builder.Append(s_dotToken)\n End If\n End If\n\n While Not names.IsEmpty()\n Dim name = names.Pop()\n If name IsNot Nothing Then\n builder.Append(name)\n builder.Append(s_dotToken)\n End If\n End While\n\n names.Free()\n\n ' name (include generic type parameters)\n builder.Append(GetName(node, options, containsGlobalKeyword:=False))\n\n ' parameter list (if any)\n If (options And DisplayNameOptions.IncludeParameters) <> 0 Then\n builder.Append(memberDeclaration.GetParameterList())\n End If\n\n ' As clause (if any)\n If (options And DisplayNameOptions.IncludeType) <> 0 Then\n Dim asClause = memberDeclaration.GetAsClause()\n If asClause IsNot Nothing Then\n builder.Append(\" \"c)\n builder.Append(asClause)\n End If\n End If\n\n Return pooled.ToStringAndFree()\n End Function\n\n Private Shared Function GetName(node As SyntaxNode, options As DisplayNameOptions, ByRef containsGlobalKeyword As Boolean) As String\n Const missingTokenPlaceholder As String = \"?\"\n\n Select Case node.Kind()\n Case SyntaxKind.CompilationUnit\n Return Nothing\n Case SyntaxKind.IdentifierName\n Dim identifier = DirectCast(node, IdentifierNameSyntax).Identifier\n Return If(identifier.IsMissing, missingTokenPlaceholder, identifier.Text)\n Case SyntaxKind.IncompleteMember\n Return missingTokenPlaceholder\n Case SyntaxKind.NamespaceBlock\n Dim nameSyntax = CType(node, NamespaceBlockSyntax).NamespaceStatement.Name\n If nameSyntax.Kind() = SyntaxKind.GlobalName Then\n containsGlobalKeyword = True\n Return Nothing\n Else\n Return GetName(nameSyntax, options, containsGlobalKeyword)\n End If\n Case SyntaxKind.QualifiedName\n Dim qualified = CType(node, QualifiedNameSyntax)\n If qualified.Left.Kind() = SyntaxKind.GlobalName Then\n containsGlobalKeyword = True\n Return GetName(qualified.Right, options, containsGlobalKeyword) ' don't use the Global prefix if specified\n Else\n Return GetName(qualified.Left, options, containsGlobalKeyword) + s_dotToken + GetName(qualified.Right, options, containsGlobalKeyword)\n End If\n End Select\n\n Dim name As String = Nothing\n Dim memberDeclaration = TryCast(node, DeclarationStatementSyntax)\n If memberDeclaration IsNot Nothing Then\n Dim nameToken = memberDeclaration.GetNameToken()\n If nameToken <> Nothing Then\n name = If(nameToken.IsMissing, missingTokenPlaceholder, nameToken.Text)\n If (options And DisplayNameOptions.IncludeTypeParameters) <> 0 Then\n Dim pooled = PooledStringBuilder.GetInstance()\n Dim builder = pooled.Builder\n builder.Append(name)\n AppendTypeParameterList(builder, memberDeclaration.GetTypeParameterList())\n name = pooled.ToStringAndFree()\n End If\n End If\n End If\n\n Debug.Assert(name IsNot Nothing, \"Unexpected node type \" + node.Kind().ToString())\n Return name\n End Function\n\n Private Shared Sub AppendTypeParameterList(builder As StringBuilder, typeParameterList As TypeParameterListSyntax)\n If typeParameterList IsNot Nothing AndAlso typeParameterList.Parameters.Count > 0 Then\n builder.Append(\"(Of \")\n builder.Append(typeParameterList.Parameters(0).Identifier.Text)\n For i = 1 To typeParameterList.Parameters.Count - 1\n builder.Append(\", \")\n builder.Append(typeParameterList.Parameters(i).Identifier.Text)\n Next\n\n builder.Append(\")\"c)\n End If\n End Sub\n\n Private Sub AppendMembers(node As SyntaxNode, list As List(Of SyntaxNode), topLevel As Boolean, methodLevel As Boolean)\n Debug.Assert(topLevel OrElse methodLevel)\n\n For Each member In node.GetMembers()\n If IsTopLevelNodeWithMembers(member) Then\n If topLevel Then\n list.Add(member)\n End If\n\n AppendMembers(member, list, topLevel, methodLevel)\n Continue For\n End If\n\n If methodLevel AndAlso IsMethodLevelMember(member) Then\n list.Add(member)\n End If\n Next\n End Sub\n\n Public Function TryGetBindableParent(token As SyntaxToken) As SyntaxNode Implements ISyntaxFacts.TryGetBindableParent\n Dim node = token.Parent\n While node IsNot Nothing\n Dim parent = node.Parent\n\n ' If this node is on the left side of a member access expression, don't ascend\n ' further or we'll end up binding to something else.\n Dim memberAccess = TryCast(parent, MemberAccessExpressionSyntax)\n If memberAccess IsNot Nothing Then\n If memberAccess.Expression Is node Then\n Exit While\n End If\n End If\n\n ' If this node is on the left side of a qualified name, don't ascend\n ' further or we'll end up binding to something else.\n Dim qualifiedName = TryCast(parent, QualifiedNameSyntax)\n If qualifiedName IsNot Nothing Then\n If qualifiedName.Left Is node Then\n Exit While\n End If\n End If\n\n ' If this node is the type of an object creation expression, return the\n ' object creation expression.\n Dim objectCreation = TryCast(parent, ObjectCreationExpressionSyntax)\n If objectCreation IsNot Nothing Then\n If objectCreation.Type Is node Then\n node = parent\n Exit While\n End If\n End If\n\n ' The inside of an interpolated string is treated as its own token so we\n ' need to force navigation to the parent expression syntax.\n If TypeOf node Is InterpolatedStringTextSyntax AndAlso TypeOf parent Is InterpolatedStringExpressionSyntax Then\n node = parent\n Exit While\n End If\n\n ' If this node is not parented by a name, we're done.\n Dim name = TryCast(parent, NameSyntax)\n If name Is Nothing Then\n Exit While\n End If\n\n node = parent\n End While\n\n Return node\n End Function\n\n Public Function GetConstructors(root As SyntaxNode, cancellationToken As CancellationToken) As IEnumerable(Of SyntaxNode) Implements ISyntaxFacts.GetConstructors\n Dim compilationUnit = TryCast(root, CompilationUnitSyntax)\n If compilationUnit Is Nothing Then\n Return SpecializedCollections.EmptyEnumerable(Of SyntaxNode)()\n End If\n\n Dim constructors = New List(Of SyntaxNode)()\n AppendConstructors(compilationUnit.Members, constructors, cancellationToken)\n Return constructors\n End Function\n\n Private Sub AppendConstructors(members As SyntaxList(Of StatementSyntax), constructors As List(Of SyntaxNode), cancellationToken As CancellationToken)\n For Each member As StatementSyntax In members\n cancellationToken.ThrowIfCancellationRequested()\n\n Dim constructor = TryCast(member, ConstructorBlockSyntax)\n If constructor IsNot Nothing Then\n constructors.Add(constructor)\n Continue For\n End If\n\n Dim [namespace] = TryCast(member, NamespaceBlockSyntax)\n If [namespace] IsNot Nothing Then\n AppendConstructors([namespace].Members, constructors, cancellationToken)\n End If\n\n Dim [class] = TryCast(member, ClassBlockSyntax)\n If [class] IsNot Nothing Then\n AppendConstructors([class].Members, constructors, cancellationToken)\n End If\n\n Dim [struct] = TryCast(member, StructureBlockSyntax)\n If [struct] IsNot Nothing Then\n AppendConstructors([struct].Members, constructors, cancellationToken)\n End If\n Next\n End Sub\n\n Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition\n Dim trivia = tree.FindTriviaToLeft(position, cancellationToken)\n If trivia.Kind = SyntaxKind.DisabledTextTrivia Then\n Return trivia.FullSpan\n End If\n\n Return Nothing\n End Function\n\n Public Function GetNameForArgument(argument As SyntaxNode) As String Implements ISyntaxFacts.GetNameForArgument\n If TryCast(argument, ArgumentSyntax)?.IsNamed Then\n Return DirectCast(argument, SimpleArgumentSyntax).NameColonEquals.Name.Identifier.ValueText\n End If\n\n Return String.Empty\n End Function\n\n Public Function GetNameForAttributeArgument(argument As SyntaxNode) As String Implements ISyntaxFacts.GetNameForAttributeArgument\n ' All argument types are ArgumentSyntax in VB.\n Return GetNameForArgument(argument)\n End Function\n\n Public Function IsLeftSideOfDot(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLeftSideOfDot\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfDot()\n End Function\n\n Public Function GetRightSideOfDot(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetRightSideOfDot\n Return If(TryCast(node, QualifiedNameSyntax)?.Right,\n TryCast(node, MemberAccessExpressionSyntax)?.Name)\n End Function\n\n Public Function GetLeftSideOfDot(node As SyntaxNode, Optional allowImplicitTarget As Boolean = False) As SyntaxNode Implements ISyntaxFacts.GetLeftSideOfDot\n Return If(TryCast(node, QualifiedNameSyntax)?.Left,\n TryCast(node, MemberAccessExpressionSyntax)?.GetExpressionOfMemberAccessExpression(allowImplicitTarget))\n End Function\n\n Public Function IsLeftSideOfExplicitInterfaceSpecifier(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLeftSideOfExplicitInterfaceSpecifier\n Return IsLeftSideOfDot(node) AndAlso TryCast(node.Parent.Parent, ImplementsClauseSyntax) IsNot Nothing\n End Function\n\n Public Function IsLeftSideOfAssignment(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLeftSideOfAssignment\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfSimpleAssignmentStatement\n End Function\n\n Public Function IsLeftSideOfAnyAssignment(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLeftSideOfAnyAssignment\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfAnyAssignmentStatement\n End Function\n\n Public Function IsLeftSideOfCompoundAssignment(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLeftSideOfCompoundAssignment\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfCompoundAssignmentStatement\n End Function\n\n Public Function GetRightHandSideOfAssignment(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetRightHandSideOfAssignment\n Return DirectCast(node, AssignmentStatementSyntax).Right\n End Function\n\n Public Function IsInferredAnonymousObjectMemberDeclarator(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsInferredAnonymousObjectMemberDeclarator\n Return node.IsKind(SyntaxKind.InferredFieldInitializer)\n End Function\n\n Public Function IsOperandOfIncrementExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsOperandOfIncrementExpression\n Return False\n End Function\n\n Public Function IsOperandOfIncrementOrDecrementExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsOperandOfIncrementOrDecrementExpression\n Return False\n End Function\n\n Public Function GetContentsOfInterpolatedString(interpolatedString As SyntaxNode) As SyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetContentsOfInterpolatedString\n Return (TryCast(interpolatedString, InterpolatedStringExpressionSyntax)?.Contents).Value\n End Function\n\n Public Function IsNumericLiteral(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsNumericLiteral\n Return token.Kind = SyntaxKind.DecimalLiteralToken OrElse\n token.Kind = SyntaxKind.FloatingLiteralToken OrElse\n token.Kind = SyntaxKind.IntegerLiteralToken\n End Function\n\n Public Function IsVerbatimStringLiteral(token As SyntaxToken) As Boolean Implements ISyntaxFacts.IsVerbatimStringLiteral\n ' VB does not have verbatim strings\n Return False\n End Function\n\n Public Function GetArgumentsOfInvocationExpression(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetArgumentsOfInvocationExpression\n Dim argumentList = DirectCast(node, InvocationExpressionSyntax).ArgumentList\n Return If(argumentList Is Nothing, Nothing, GetArgumentsOfArgumentList(argumentList))\n End Function\n\n Public Function GetArgumentsOfObjectCreationExpression(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetArgumentsOfObjectCreationExpression\n Dim argumentList = DirectCast(node, ObjectCreationExpressionSyntax).ArgumentList\n Return If(argumentList Is Nothing, Nothing, GetArgumentsOfArgumentList(argumentList))\n End Function\n\n Public Function GetArgumentsOfArgumentList(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetArgumentsOfArgumentList\n Return DirectCast(node, ArgumentListSyntax).Arguments\n End Function\n\n Public Function ConvertToSingleLine(node As SyntaxNode, Optional useElasticTrivia As Boolean = False) As SyntaxNode Implements ISyntaxFacts.ConvertToSingleLine\n Return node.ConvertToSingleLine(useElasticTrivia)\n End Function\n\n Public Function IsDocumentationComment(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDocumentationComment\n Return node.IsKind(SyntaxKind.DocumentationCommentTrivia)\n End Function\n\n Public Function IsUsingOrExternOrImport(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsUsingOrExternOrImport\n Return node.IsKind(SyntaxKind.ImportsStatement)\n End Function\n\n Public Function IsGlobalAssemblyAttribute(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsGlobalAssemblyAttribute\n Return IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword)\n End Function\n\n Public Function IsModuleAssemblyAttribute(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsGlobalModuleAttribute\n Return IsGlobalAttribute(node, SyntaxKind.ModuleKeyword)\n End Function\n\n Private Shared Function IsGlobalAttribute(node As SyntaxNode, attributeTarget As SyntaxKind) As Boolean\n If node.IsKind(SyntaxKind.Attribute) Then\n Dim attributeNode = CType(node, AttributeSyntax)\n If attributeNode.Target IsNot Nothing Then\n Return attributeNode.Target.AttributeModifier.IsKind(attributeTarget)\n End If\n End If\n\n Return False\n End Function\n\n Public Function IsDeclaration(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeclaration\n ' From the Visual Basic language spec:\n ' NamespaceMemberDeclaration :=\n ' NamespaceDeclaration |\n ' TypeDeclaration\n ' TypeDeclaration ::=\n ' ModuleDeclaration |\n ' NonModuleDeclaration\n ' NonModuleDeclaration ::=\n ' EnumDeclaration |\n ' StructureDeclaration |\n ' InterfaceDeclaration |\n ' ClassDeclaration |\n ' DelegateDeclaration\n ' ClassMemberDeclaration ::=\n ' NonModuleDeclaration |\n ' EventMemberDeclaration |\n ' VariableMemberDeclaration |\n ' ConstantMemberDeclaration |\n ' MethodMemberDeclaration |\n ' PropertyMemberDeclaration |\n ' ConstructorMemberDeclaration |\n ' OperatorDeclaration\n Select Case node.Kind()\n ' Because fields declarations can define multiple symbols \"Public a, b As Integer\"\n ' We want to get the VariableDeclarator node inside the field declaration to print out the symbol for the name.\n Case SyntaxKind.VariableDeclarator\n If (node.Parent.IsKind(SyntaxKind.FieldDeclaration)) Then\n Return True\n End If\n\n Return False\n\n Case SyntaxKind.NamespaceStatement,\n SyntaxKind.NamespaceBlock,\n SyntaxKind.ModuleStatement,\n SyntaxKind.ModuleBlock,\n SyntaxKind.EnumStatement,\n SyntaxKind.EnumBlock,\n SyntaxKind.StructureStatement,\n SyntaxKind.StructureBlock,\n SyntaxKind.InterfaceStatement,\n SyntaxKind.InterfaceBlock,\n SyntaxKind.ClassStatement,\n SyntaxKind.ClassBlock,\n SyntaxKind.DelegateFunctionStatement,\n SyntaxKind.DelegateSubStatement,\n SyntaxKind.EventStatement,\n SyntaxKind.EventBlock,\n SyntaxKind.AddHandlerAccessorBlock,\n SyntaxKind.RemoveHandlerAccessorBlock,\n SyntaxKind.FieldDeclaration,\n SyntaxKind.SubStatement,\n SyntaxKind.SubBlock,\n SyntaxKind.FunctionStatement,\n SyntaxKind.FunctionBlock,\n SyntaxKind.PropertyStatement,\n SyntaxKind.PropertyBlock,\n SyntaxKind.GetAccessorBlock,\n SyntaxKind.SetAccessorBlock,\n SyntaxKind.SubNewStatement,\n SyntaxKind.ConstructorBlock,\n SyntaxKind.OperatorStatement,\n SyntaxKind.OperatorBlock\n Return True\n End Select\n\n Return False\n End Function\n\n ' TypeDeclaration ::=\n ' ModuleDeclaration |\n ' NonModuleDeclaration\n ' NonModuleDeclaration ::=\n ' EnumDeclaration |\n ' StructureDeclaration |\n ' InterfaceDeclaration |\n ' ClassDeclaration |\n ' DelegateDeclaration\n Public Function IsTypeDeclaration(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsTypeDeclaration\n Select Case node.Kind()\n Case SyntaxKind.EnumBlock,\n SyntaxKind.StructureBlock,\n SyntaxKind.InterfaceBlock,\n SyntaxKind.ClassBlock,\n SyntaxKind.ModuleBlock,\n SyntaxKind.DelegateSubStatement,\n SyntaxKind.DelegateFunctionStatement\n Return True\n End Select\n\n Return False\n End Function\n\n Public Function IsSimpleAssignmentStatement(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsSimpleAssignmentStatement\n Return node.IsKind(SyntaxKind.SimpleAssignmentStatement)\n End Function\n\n Public Sub GetPartsOfAssignmentStatement(statement As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfAssignmentStatement\n ' VB only has assignment statements, so this can just delegate to that helper\n GetPartsOfAssignmentExpressionOrStatement(statement, left, operatorToken, right)\n End Sub\n\n Public Sub GetPartsOfAssignmentExpressionOrStatement(statement As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfAssignmentExpressionOrStatement\n Dim assignment = DirectCast(statement, AssignmentStatementSyntax)\n left = assignment.Left\n operatorToken = assignment.OperatorToken\n right = assignment.Right\n End Sub\n\n Public Function GetIdentifierOfSimpleName(node As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfSimpleName\n Return DirectCast(node, SimpleNameSyntax).Identifier\n End Function\n\n Public Function GetIdentifierOfVariableDeclarator(node As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfVariableDeclarator\n Return DirectCast(node, VariableDeclaratorSyntax).Names.Last().Identifier\n End Function\n\n Public Function GetIdentifierOfParameter(node As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfParameter\n Return DirectCast(node, ParameterSyntax).Identifier.Identifier\n End Function\n\n Public Function GetIdentifierOfTypeDeclaration(node As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfTypeDeclaration\n Select Case node.Kind()\n Case SyntaxKind.EnumStatement,\n SyntaxKind.StructureStatement,\n SyntaxKind.InterfaceStatement,\n SyntaxKind.ClassStatement,\n SyntaxKind.ModuleStatement\n Return DirectCast(node, TypeStatementSyntax).Identifier\n\n Case SyntaxKind.DelegateSubStatement,\n SyntaxKind.DelegateFunctionStatement\n Return DirectCast(node, DelegateStatementSyntax).Identifier\n End Select\n\n Throw ExceptionUtilities.UnexpectedValue(node)\n End Function\n\n Public Function GetIdentifierOfIdentifierName(node As SyntaxNode) As SyntaxToken Implements ISyntaxFacts.GetIdentifierOfIdentifierName\n Return DirectCast(node, IdentifierNameSyntax).Identifier\n End Function\n\n Public Function IsDeclaratorOfLocalDeclarationStatement(declarator As SyntaxNode, localDeclarationStatement As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeclaratorOfLocalDeclarationStatement\n Return DirectCast(localDeclarationStatement, LocalDeclarationStatementSyntax).Declarators.\n Contains(DirectCast(declarator, VariableDeclaratorSyntax))\n End Function\n\n Public Function AreEquivalent(token1 As SyntaxToken, token2 As SyntaxToken) As Boolean Implements ISyntaxFacts.AreEquivalent\n Return SyntaxFactory.AreEquivalent(token1, token2)\n End Function\n\n Public Function AreEquivalent(node1 As SyntaxNode, node2 As SyntaxNode) As Boolean Implements ISyntaxFacts.AreEquivalent\n Return SyntaxFactory.AreEquivalent(node1, node2)\n End Function\n\n Public Function IsExpressionOfForeach(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsExpressionOfForeach\n Return node IsNot Nothing AndAlso TryCast(node.Parent, ForEachStatementSyntax)?.Expression Is node\n End Function\n\n Public Function GetExpressionOfExpressionStatement(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfExpressionStatement\n Return DirectCast(node, ExpressionStatementSyntax).Expression\n End Function\n\n Public Function IsIsExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsIsExpression\n Return node.IsKind(SyntaxKind.TypeOfIsExpression)\n End Function\n\n Public Function WalkDownParentheses(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.WalkDownParentheses\n Return If(TryCast(node, ExpressionSyntax)?.WalkDownParentheses(), node)\n End Function\n\n Public Sub GetPartsOfTupleExpression(Of TArgumentSyntax As SyntaxNode)(\n node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef arguments As SeparatedSyntaxList(Of TArgumentSyntax), ByRef closeParen As SyntaxToken) Implements ISyntaxFacts.GetPartsOfTupleExpression\n\n Dim tupleExpr = DirectCast(node, TupleExpressionSyntax)\n openParen = tupleExpr.OpenParenToken\n arguments = CType(CType(tupleExpr.Arguments, SeparatedSyntaxList(Of SyntaxNode)), SeparatedSyntaxList(Of TArgumentSyntax))\n closeParen = tupleExpr.CloseParenToken\n End Sub\n\n Private Function ISyntaxFacts_IsSingleLineCommentTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsSingleLineCommentTrivia\n Return MyBase.IsSingleLineCommentTrivia(trivia)\n End Function\n\n Private Function ISyntaxFacts_IsMultiLineCommentTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsMultiLineCommentTrivia\n Return MyBase.IsMultiLineCommentTrivia(trivia)\n End Function\n\n Private Function ISyntaxFacts_IsSingleLineDocCommentTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsSingleLineDocCommentTrivia\n Return MyBase.IsSingleLineDocCommentTrivia(trivia)\n End Function\n\n Private Function ISyntaxFacts_IsMultiLineDocCommentTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsMultiLineDocCommentTrivia\n Return MyBase.IsMultiLineDocCommentTrivia(trivia)\n Return False\n End Function\n\n Private Function ISyntaxFacts_IsShebangDirectiveTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsShebangDirectiveTrivia\n Return MyBase.IsShebangDirectiveTrivia(trivia)\n End Function\n\n Public Overrides Function IsPreprocessorDirective(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsPreprocessorDirective\n Return SyntaxFacts.IsPreprocessorDirective(trivia.Kind())\n End Function\n\n Public Function IsRegularComment(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsRegularComment\n Return trivia.Kind = SyntaxKind.CommentTrivia\n End Function\n\n Public Function IsDocumentationComment(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsDocumentationComment\n Return trivia.Kind = SyntaxKind.DocumentationCommentTrivia\n End Function\n\n Public Function IsElastic(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsElastic\n Return trivia.IsElastic()\n End Function\n\n Public Function IsPragmaDirective(trivia As SyntaxTrivia, ByRef isDisable As Boolean, ByRef isActive As Boolean, ByRef errorCodes As SeparatedSyntaxList(Of SyntaxNode)) As Boolean Implements ISyntaxFacts.IsPragmaDirective\n Return trivia.IsPragmaDirective(isDisable, isActive, errorCodes)\n End Function\n\n Public Overrides Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective\n Return token.ContainsInterleavedDirective(span, cancellationToken)\n End Function\n\n Public Function IsDocumentationCommentExteriorTrivia(trivia As SyntaxTrivia) As Boolean Implements ISyntaxFacts.IsDocumentationCommentExteriorTrivia\n Return trivia.Kind() = SyntaxKind.DocumentationCommentExteriorTrivia\n End Function\n\n Public Function GetModifiers(node As SyntaxNode) As SyntaxTokenList Implements ISyntaxFacts.GetModifiers\n Return node.GetModifiers()\n End Function\n\n Public Function WithModifiers(node As SyntaxNode, modifiers As SyntaxTokenList) As SyntaxNode Implements ISyntaxFacts.WithModifiers\n Return node.WithModifiers(modifiers)\n End Function\n\n Public Function GetVariablesOfLocalDeclarationStatement(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetVariablesOfLocalDeclarationStatement\n Return DirectCast(node, LocalDeclarationStatementSyntax).Declarators\n End Function\n\n Public Function GetInitializerOfVariableDeclarator(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetInitializerOfVariableDeclarator\n Return DirectCast(node, VariableDeclaratorSyntax).Initializer\n End Function\n\n Public Function GetTypeOfVariableDeclarator(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetTypeOfVariableDeclarator\n Dim declarator = DirectCast(node, VariableDeclaratorSyntax)\n Return TryCast(declarator.AsClause, SimpleAsClauseSyntax)?.Type\n End Function\n\n Public Function GetValueOfEqualsValueClause(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetValueOfEqualsValueClause\n Return DirectCast(node, EqualsValueSyntax).Value\n End Function\n\n Public Function IsScopeBlock(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsScopeBlock\n ' VB has no equivalent of curly braces.\n Return False\n End Function\n\n Public Function IsExecutableBlock(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsExecutableBlock\n Return node.IsExecutableBlock()\n End Function\n\n Public Function GetExecutableBlockStatements(node As SyntaxNode) As IReadOnlyList(Of SyntaxNode) Implements ISyntaxFacts.GetExecutableBlockStatements\n Return node.GetExecutableBlockStatements()\n End Function\n\n Public Function FindInnermostCommonExecutableBlock(nodes As IEnumerable(Of SyntaxNode)) As SyntaxNode Implements ISyntaxFacts.FindInnermostCommonExecutableBlock\n Return nodes.FindInnermostCommonExecutableBlock()\n End Function\n\n Public Function IsStatementContainer(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsStatementContainer\n Return IsExecutableBlock(node)\n End Function\n\n Public Function GetStatementContainerStatements(node As SyntaxNode) As IReadOnlyList(Of SyntaxNode) Implements ISyntaxFacts.GetStatementContainerStatements\n Return GetExecutableBlockStatements(node)\n End Function\n\n Public Function IsConversionExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsConversionExpression\n Return node.Kind = SyntaxKind.CTypeExpression\n End Function\n\n Public Function IsCastExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsCastExpression\n Return node.Kind = SyntaxKind.DirectCastExpression\n End Function\n\n Public Sub GetPartsOfCastExpression(node As SyntaxNode, ByRef type As SyntaxNode, ByRef expression As SyntaxNode) Implements ISyntaxFacts.GetPartsOfCastExpression\n Dim cast = DirectCast(node, DirectCastExpressionSyntax)\n type = cast.Type\n expression = cast.Expression\n End Sub\n\n Public Function GetDeconstructionReferenceLocation(node As SyntaxNode) As Location Implements ISyntaxFacts.GetDeconstructionReferenceLocation\n Throw New NotImplementedException()\n End Function\n\n Public Function GetDeclarationIdentifierIfOverride(token As SyntaxToken) As SyntaxToken? Implements ISyntaxFacts.GetDeclarationIdentifierIfOverride\n If token.Kind() = SyntaxKind.OverridesKeyword Then\n Dim parent = token.Parent\n\n Select Case parent.Kind()\n Case SyntaxKind.SubStatement, SyntaxKind.FunctionStatement\n Dim method = DirectCast(parent, MethodStatementSyntax)\n Return method.Identifier\n\n Case SyntaxKind.PropertyStatement\n Dim [property] = DirectCast(parent, PropertyStatementSyntax)\n Return [property].Identifier\n End Select\n End If\n\n Return Nothing\n End Function\n\n Public Function IsPostfixUnaryExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsPostfixUnaryExpression\n ' Does not exist in VB.\n Return False\n End Function\n\n Public Function IsMemberBindingExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMemberBindingExpression\n ' Does not exist in VB. VB represents a member binding as a MemberAccessExpression with null target.\n Return False\n End Function\n\n Public Function IsNameOfMemberBindingExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNameOfMemberBindingExpression\n ' Does not exist in VB. VB represents a member binding as a MemberAccessExpression with null target.\n Return False\n End Function\n\n Public Overrides Function GetAttributeLists(node As SyntaxNode) As SyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetAttributeLists\n Return node.GetAttributeLists()\n End Function\n\n Public Function IsUsingAliasDirective(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsUsingAliasDirective\n Dim importStatement = TryCast(node, ImportsStatementSyntax)\n\n If (importStatement IsNot Nothing) Then\n For Each importsClause In importStatement.ImportsClauses\n\n If importsClause.Kind = SyntaxKind.SimpleImportsClause Then\n Dim simpleImportsClause = DirectCast(importsClause, SimpleImportsClauseSyntax)\n\n If simpleImportsClause.Alias IsNot Nothing Then\n Return True\n End If\n End If\n Next\n End If\n\n Return False\n End Function\n\n Public Sub GetPartsOfUsingAliasDirective(\n node As SyntaxNode,\n ByRef globalKeyword As SyntaxToken,\n ByRef [alias] As SyntaxToken,\n ByRef name As SyntaxNode) Implements ISyntaxFacts.GetPartsOfUsingAliasDirective\n Dim importStatement = DirectCast(node, ImportsStatementSyntax)\n For Each importsClause In importStatement.ImportsClauses\n\n If importsClause.Kind = SyntaxKind.SimpleImportsClause Then\n Dim simpleImportsClause = DirectCast(importsClause, SimpleImportsClauseSyntax)\n\n If simpleImportsClause.Alias IsNot Nothing Then\n globalKeyword = Nothing\n [alias] = simpleImportsClause.Alias.Identifier\n name = simpleImportsClause.Name\n Return\n End If\n End If\n Next\n\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Function IsParameterNameXmlElementSyntax(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsParameterNameXmlElementSyntax\n Dim xmlElement = TryCast(node, XmlElementSyntax)\n If xmlElement IsNot Nothing Then\n Dim name = TryCast(xmlElement.StartTag.Name, XmlNameSyntax)\n Return name?.LocalName.ValueText = DocumentationCommentXmlNames.ParameterElementName\n End If\n\n Return False\n End Function\n\n Public Overrides Function GetContentFromDocumentationCommentTriviaSyntax(trivia As SyntaxTrivia) As SyntaxList(Of SyntaxNode) Implements ISyntaxFacts.GetContentFromDocumentationCommentTriviaSyntax\n Dim documentationCommentTrivia = TryCast(trivia.GetStructure(), DocumentationCommentTriviaSyntax)\n If documentationCommentTrivia IsNot Nothing Then\n Return documentationCommentTrivia.Content\n End If\n\n Return Nothing\n End Function\n\n Friend Shared Function IsChildOf(node As SyntaxNode, kind As SyntaxKind) As Boolean\n Return node.Parent IsNot Nothing AndAlso node.Parent.IsKind(kind)\n End Function\n\n Friend Shared Function IsChildOfVariableDeclaration(node As SyntaxNode) As Boolean\n Return IsChildOf(node, SyntaxKind.FieldDeclaration) OrElse IsChildOf(node, SyntaxKind.LocalDeclarationStatement)\n End Function\n\n Private Shared Function GetDeclarationCount(nodes As IReadOnlyList(Of SyntaxNode)) As Integer\n Dim count As Integer = 0\n For i = 0 To nodes.Count - 1\n count = count + GetDeclarationCount(nodes(i))\n Next\n\n Return count\n End Function\n\n Friend Shared Function GetDeclarationCount(node As SyntaxNode) As Integer\n Select Case node.Kind\n Case SyntaxKind.FieldDeclaration\n Return GetDeclarationCount(DirectCast(node, FieldDeclarationSyntax).Declarators)\n Case SyntaxKind.LocalDeclarationStatement\n Return GetDeclarationCount(DirectCast(node, LocalDeclarationStatementSyntax).Declarators)\n Case SyntaxKind.VariableDeclarator\n Return DirectCast(node, VariableDeclaratorSyntax).Names.Count\n Case SyntaxKind.AttributesStatement\n Return GetDeclarationCount(DirectCast(node, AttributesStatementSyntax).AttributeLists)\n Case SyntaxKind.AttributeList\n Return DirectCast(node, AttributeListSyntax).Attributes.Count\n Case SyntaxKind.ImportsStatement\n Return DirectCast(node, ImportsStatementSyntax).ImportsClauses.Count\n End Select\n\n Return 1\n End Function\n\n Public Function SupportsNotPattern(options As ParseOptions) As Boolean Implements ISyntaxFacts.SupportsNotPattern\n Return False\n End Function\n\n Public Function IsIsPatternExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsIsPatternExpression\n Return False\n End Function\n\n Public Function IsAnyPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAnyPattern\n Return False\n End Function\n\n Public Function IsAndPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAndPattern\n Return False\n End Function\n\n Public Function IsBinaryPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsBinaryPattern\n Return False\n End Function\n\n Public Function IsConstantPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsConstantPattern\n Return False\n End Function\n\n Public Function IsDeclarationPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsDeclarationPattern\n Return False\n End Function\n\n Public Function IsNotPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsNotPattern\n Return False\n End Function\n\n Public Function IsOrPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsOrPattern\n Return False\n End Function\n\n Public Function IsParenthesizedPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsParenthesizedPattern\n Return False\n End Function\n\n Public Function IsRecursivePattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsRecursivePattern\n Return False\n End Function\n\n Public Function IsUnaryPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsUnaryPattern\n Return False\n End Function\n\n Public Function IsTypePattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsTypePattern\n Return False\n End Function\n\n Public Function IsVarPattern(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsVarPattern\n Return False\n End Function\n\n Public Sub GetPartsOfIsPatternExpression(node As SyntaxNode, ByRef left As SyntaxNode, ByRef isToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfIsPatternExpression\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Function GetExpressionOfConstantPattern(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfConstantPattern\n Throw ExceptionUtilities.Unreachable\n End Function\n\n Public Sub GetPartsOfParenthesizedPattern(node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef pattern As SyntaxNode, ByRef closeParen As SyntaxToken) Implements ISyntaxFacts.GetPartsOfParenthesizedPattern\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Sub GetPartsOfBinaryPattern(node As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfBinaryPattern\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Sub GetPartsOfUnaryPattern(node As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef pattern As SyntaxNode) Implements ISyntaxFacts.GetPartsOfUnaryPattern\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Sub GetPartsOfDeclarationPattern(node As SyntaxNode, ByRef type As SyntaxNode, ByRef designation As SyntaxNode) Implements ISyntaxFacts.GetPartsOfDeclarationPattern\n Throw New NotImplementedException()\n End Sub\n\n Public Sub GetPartsOfRecursivePattern(node As SyntaxNode, ByRef type As SyntaxNode, ByRef positionalPart As SyntaxNode, ByRef propertyPart As SyntaxNode, ByRef designation As SyntaxNode) Implements ISyntaxFacts.GetPartsOfRecursivePattern\n Throw New NotImplementedException()\n End Sub\n\n Public Function GetTypeOfTypePattern(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetTypeOfTypePattern\n Throw New NotImplementedException()\n End Function\n\n Public Sub GetPartsOfInterpolationExpression(node As SyntaxNode, ByRef stringStartToken As SyntaxToken, ByRef contents As SyntaxList(Of SyntaxNode), ByRef stringEndToken As SyntaxToken) Implements ISyntaxFacts.GetPartsOfInterpolationExpression\n Dim interpolatedStringExpressionSyntax As InterpolatedStringExpressionSyntax = DirectCast(node, InterpolatedStringExpressionSyntax)\n stringStartToken = interpolatedStringExpressionSyntax.DollarSignDoubleQuoteToken\n contents = interpolatedStringExpressionSyntax.Contents\n stringEndToken = interpolatedStringExpressionSyntax.DoubleQuoteToken\n End Sub\n\n Public Function IsVerbatimInterpolatedStringExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsVerbatimInterpolatedStringExpression\n Return False\n End Function\n\n#Region \"IsXXX members\"\n\n Public Function IsAnonymousFunctionExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAnonymousFunctionExpression\n Return TypeOf node Is LambdaExpressionSyntax\n End Function\n\n Public Function IsBaseNamespaceDeclaration( node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsBaseNamespaceDeclaration\n Return TypeOf node Is NamespaceBlockSyntax\n End Function\n\n Public Function IsBinaryExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsBinaryExpression\n Return TypeOf node Is BinaryExpressionSyntax\n End Function\n\n Public Function IsLiteralExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsLiteralExpression\n Return TypeOf node Is LiteralExpressionSyntax\n End Function\n\n Public Function IsMemberAccessExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsMemberAccessExpression\n Return TypeOf node Is MemberAccessExpressionSyntax\n End Function\n\n Public Function IsSimpleName(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsSimpleName\n Return TypeOf node Is SimpleNameSyntax\n End Function\n\n#End Region\n\n#Region \"GetPartsOfXXX members\"\n\n Public Sub GetPartsOfBinaryExpression(node As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfBinaryExpression\n Dim binaryExpression = DirectCast(node, BinaryExpressionSyntax)\n left = binaryExpression.Left\n operatorToken = binaryExpression.OperatorToken\n right = binaryExpression.Right\n End Sub\n\n Public Sub GetPartsOfCompilationUnit(node As SyntaxNode, ByRef [imports] As SyntaxList(Of SyntaxNode), ByRef attributeLists As SyntaxList(Of SyntaxNode), ByRef members As SyntaxList(Of SyntaxNode)) Implements ISyntaxFacts.GetPartsOfCompilationUnit\n Dim compilationUnit = DirectCast(node, CompilationUnitSyntax)\n [imports] = compilationUnit.Imports\n attributeLists = compilationUnit.Attributes\n members = compilationUnit.Members\n End Sub\n\n Public Sub GetPartsOfConditionalAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef whenNotNull As SyntaxNode) Implements ISyntaxFacts.GetPartsOfConditionalAccessExpression\n Dim conditionalAccess = DirectCast(node, ConditionalAccessExpressionSyntax)\n expression = conditionalAccess.Expression\n operatorToken = conditionalAccess.QuestionMarkToken\n whenNotNull = conditionalAccess.WhenNotNull\n End Sub\n\n Public Sub GetPartsOfConditionalExpression(node As SyntaxNode, ByRef condition As SyntaxNode, ByRef whenTrue As SyntaxNode, ByRef whenFalse As SyntaxNode) Implements ISyntaxFacts.GetPartsOfConditionalExpression\n Dim conditionalExpression = DirectCast(node, TernaryConditionalExpressionSyntax)\n condition = conditionalExpression.Condition\n whenTrue = conditionalExpression.WhenTrue\n whenFalse = conditionalExpression.WhenFalse\n End Sub\n\n Public Sub GetPartsOfInvocationExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef argumentList As SyntaxNode) Implements ISyntaxFacts.GetPartsOfInvocationExpression\n Dim invocation = DirectCast(node, InvocationExpressionSyntax)\n expression = invocation.Expression\n argumentList = invocation.ArgumentList\n End Sub\n\n Public Sub GetPartsOfMemberAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef name As SyntaxNode) Implements ISyntaxFacts.GetPartsOfMemberAccessExpression\n Dim memberAccess = DirectCast(node, MemberAccessExpressionSyntax)\n expression = memberAccess.Expression\n operatorToken = memberAccess.OperatorToken\n name = memberAccess.Name\n End Sub\n\n Public Sub GetPartsOfBaseNamespaceDeclaration(node As SyntaxNode, ByRef name As SyntaxNode, ByRef [imports] As SyntaxList(Of SyntaxNode), ByRef members As SyntaxList(Of SyntaxNode)) Implements ISyntaxFacts.GetPartsOfBaseNamespaceDeclaration\n Dim namespaceBlock = DirectCast(node, NamespaceBlockSyntax)\n name = namespaceBlock.NamespaceStatement.Name\n [imports] = Nothing\n members = namespaceBlock.Members\n End Sub\n\n Public Sub GetPartsOfObjectCreationExpression(node As SyntaxNode, ByRef type As SyntaxNode, ByRef argumentList As SyntaxNode, ByRef initializer As SyntaxNode) Implements ISyntaxFacts.GetPartsOfObjectCreationExpression\n Dim objectCreationExpression = DirectCast(node, ObjectCreationExpressionSyntax)\n type = objectCreationExpression.Type\n argumentList = objectCreationExpression.ArgumentList\n initializer = objectCreationExpression.Initializer\n End Sub\n\n Public Sub GetPartsOfParenthesizedExpression(node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef expression As SyntaxNode, ByRef closeParen As SyntaxToken) Implements ISyntaxFacts.GetPartsOfParenthesizedExpression\n Dim parenthesizedExpression = DirectCast(node, ParenthesizedExpressionSyntax)\n openParen = parenthesizedExpression.OpenParenToken\n expression = parenthesizedExpression.Expression\n closeParen = parenthesizedExpression.CloseParenToken\n End Sub\n\n Public Sub GetPartsOfPrefixUnaryExpression(node As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef operand As SyntaxNode) Implements ISyntaxFacts.GetPartsOfPrefixUnaryExpression\n Dim unaryExpression = DirectCast(node, UnaryExpressionSyntax)\n operatorToken = unaryExpression.OperatorToken\n operand = unaryExpression.Operand\n End Sub\n\n Public Sub GetPartsOfQualifiedName(node As SyntaxNode, ByRef left As SyntaxNode, ByRef dotToken As SyntaxToken, ByRef right As SyntaxNode) Implements ISyntaxFacts.GetPartsOfQualifiedName\n Dim qualifiedName = DirectCast(node, QualifiedNameSyntax)\n left = qualifiedName.Left\n dotToken = qualifiedName.DotToken\n right = qualifiedName.Right\n End Sub\n\n#End Region\n\n#Region \"GetXXXOfYYY members\"\n\n Public Function GetExpressionOfAwaitExpression(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfAwaitExpression\n Return DirectCast(node, AwaitExpressionSyntax).Expression\n End Function\n\n Public Function GetExpressionOfThrowExpression(node As SyntaxNode) As SyntaxNode Implements ISyntaxFacts.GetExpressionOfThrowExpression\n ' ThrowExpression doesn't exist in VB\n Throw New NotImplementedException()\n End Function\n\n#End Region\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Collections.Immutable\nImports System.Text\nImports System.Threading\nImports Microsoft.CodeAnalysis\nImports Microsoft.CodeAnalysis.LanguageServices\nImports Microsoft.CodeAnalysis.PooledObjects\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports Microsoft.CodeAnalysis.VisualBasic.SyntaxFacts\nImports System.Diagnostics.CodeAnalysis\n\n#If CODE_STYLE Then\nImports Microsoft.CodeAnalysis.Internal.Editing\n#Else\nImports Microsoft.CodeAnalysis.Editing\n#End If\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices\n Friend Class VisualBasicSyntaxFacts\n Inherits AbstractSyntaxFacts\n Implements ISyntaxFacts\n\n Public Shared ReadOnly Property Instance As New VisualBasicSyntaxFacts\n\n Protected Sub New()\n End Sub\n\n Public Overrides ReadOnly Property IsCaseSensitive As Boolean\n Get\n Return False\n End Get\n End Property\n\n Public Overrides ReadOnly Property StringComparer As StringComparer\n Get\n Return CaseInsensitiveComparison.Comparer\n End Get\n End Property\n\n Public Overrides ReadOnly Property ElasticMarker As SyntaxTrivia\n Get\n Return SyntaxFactory.ElasticMarker\n End Get\n End Property\n\n Public Overrides ReadOnly Property ElasticCarriageReturnLineFeed As SyntaxTrivia\n Get\n Return SyntaxFactory.ElasticCarriageReturnLineFeed\n End Get\n End Property\n\n Public Overrides ReadOnly Property SyntaxKinds As ISyntaxKinds = VisualBasicSyntaxKinds.Instance\n\n Public Overrides Function SupportsIndexingInitializer(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function SupportsThrowExpression(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function SupportsLocalFunctionDeclaration(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function SupportsRecord(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function SupportsRecordStruct(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function ParseToken(text As String) As SyntaxToken\n Return SyntaxFactory.ParseToken(text, startStatement:=True)\n End Function\n\n Public Overrides Function ParseLeadingTrivia(text As String) As SyntaxTriviaList\n Return SyntaxFactory.ParseLeadingTrivia(text)\n End Function\n\n Public Overrides Function EscapeIdentifier(identifier As String) As String\n Dim keywordKind = SyntaxFacts.GetKeywordKind(identifier)\n Dim needsEscaping = keywordKind <> SyntaxKind.None\n\n Return If(needsEscaping, \"[\" & identifier & \"]\", identifier)\n End Function\n\n Public Overrides Function IsVerbatimIdentifier(token As SyntaxToken) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsOperator(token As SyntaxToken) As Boolean\n Return (IsUnaryExpressionOperatorToken(CType(token.Kind, SyntaxKind)) AndAlso (TypeOf token.Parent Is UnaryExpressionSyntax OrElse TypeOf token.Parent Is OperatorStatementSyntax)) OrElse\n (IsBinaryExpressionOperatorToken(CType(token.Kind, SyntaxKind)) AndAlso (TypeOf token.Parent Is BinaryExpressionSyntax OrElse TypeOf token.Parent Is OperatorStatementSyntax))\n End Function\n\n Public Overrides Function IsContextualKeyword(token As SyntaxToken) As Boolean\n Return token.IsContextualKeyword()\n End Function\n\n Public Overrides Function IsReservedKeyword(token As SyntaxToken) As Boolean\n Return token.IsReservedKeyword()\n End Function\n\n Public Overrides Function IsPreprocessorKeyword(token As SyntaxToken) As Boolean\n Return token.IsPreprocessorKeyword()\n End Function\n\n Public Overrides Function IsPreProcessorDirectiveContext(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean\n Return syntaxTree.IsInPreprocessorDirectiveContext(position, cancellationToken)\n End Function\n\n Public Overrides Function TryGetCorrespondingOpenBrace(token As SyntaxToken, ByRef openBrace As SyntaxToken) As Boolean\n\n If token.Kind = SyntaxKind.CloseBraceToken Then\n Dim tuples = token.Parent.GetBraces()\n openBrace = tuples.openBrace\n Return openBrace.Kind = SyntaxKind.OpenBraceToken\n End If\n\n Return False\n End Function\n\n Public Overrides Function IsEntirelyWithinStringOrCharOrNumericLiteral(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean\n If syntaxTree Is Nothing Then\n Return False\n End If\n\n Return syntaxTree.IsEntirelyWithinStringOrCharOrNumericLiteral(position, cancellationToken)\n End Function\n\n Public Overrides Function IsDirective(node As SyntaxNode) As Boolean\n Return TypeOf node Is DirectiveTriviaSyntax\n End Function\n\n Public Overrides Function TryGetExternalSourceInfo(node As SyntaxNode, ByRef info As ExternalSourceInfo) As Boolean\n Select Case node.Kind\n Case SyntaxKind.ExternalSourceDirectiveTrivia\n info = New ExternalSourceInfo(CInt(DirectCast(node, ExternalSourceDirectiveTriviaSyntax).LineStart.Value), False)\n Return True\n\n Case SyntaxKind.EndExternalSourceDirectiveTrivia\n info = New ExternalSourceInfo(Nothing, True)\n Return True\n End Select\n\n Return False\n End Function\n\n Public Overrides Function IsDeclarationExpression(node As SyntaxNode) As Boolean\n ' VB doesn't support declaration expressions\n Return False\n End Function\n\n Public Overrides Function IsAttributeName(node As SyntaxNode) As Boolean\n Return node.IsParentKind(SyntaxKind.Attribute) AndAlso\n DirectCast(node.Parent, AttributeSyntax).Name Is node\n End Function\n\n Public Overrides Function IsNameOfSimpleMemberAccessExpression(node As SyntaxNode) As Boolean\n Dim vbNode = TryCast(node, ExpressionSyntax)\n Return vbNode IsNot Nothing AndAlso vbNode.IsSimpleMemberAccessExpressionName()\n End Function\n\n Public Overrides Function IsNameOfAnyMemberAccessExpression(node As SyntaxNode) As Boolean\n Dim memberAccess = TryCast(node?.Parent, MemberAccessExpressionSyntax)\n Return memberAccess IsNot Nothing AndAlso memberAccess.Name Is node\n End Function\n\n Public Overrides Function GetStandaloneExpression(node As SyntaxNode) As SyntaxNode\n Return SyntaxFactory.GetStandaloneExpression(TryCast(node, ExpressionSyntax))\n End Function\n\n Public Overrides Function GetRootConditionalAccessExpression(node As SyntaxNode) As SyntaxNode\n Return TryCast(node, ExpressionSyntax).GetRootConditionalAccessExpression()\n End Function\n\n Public Overrides Function IsNamedArgument(node As SyntaxNode) As Boolean\n Dim arg = TryCast(node, SimpleArgumentSyntax)\n Return arg?.NameColonEquals IsNot Nothing\n End Function\n\n Public Overrides Function IsNameOfNamedArgument(node As SyntaxNode) As Boolean\n Return node.CheckParent(Of SimpleArgumentSyntax)(Function(p) p.IsNamed AndAlso p.NameColonEquals.Name Is node)\n End Function\n\n Public Overrides Function GetNameOfParameter(node As SyntaxNode) As SyntaxToken?\n Return DirectCast(node, ParameterSyntax).Identifier?.Identifier\n End Function\n\n Public Overrides Function GetDefaultOfParameter(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, ParameterSyntax).Default\n End Function\n\n Public Overrides Function GetParameterList(node As SyntaxNode) As SyntaxNode\n Return node.GetParameterList()\n End Function\n\n Public Overrides Function IsParameterList(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.ParameterList)\n End Function\n\n Public Overrides Function GetIdentifierOfGenericName(genericName As SyntaxNode) As SyntaxToken\n Return DirectCast(genericName, GenericNameSyntax).Identifier\n End Function\n\n Public Overrides Function IsUsingDirectiveName(node As SyntaxNode) As Boolean\n Return node.IsParentKind(SyntaxKind.SimpleImportsClause) AndAlso\n DirectCast(node.Parent, SimpleImportsClauseSyntax).Name Is node\n End Function\n\n Public Overrides Function IsDeconstructionAssignment(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsDeconstructionForEachStatement(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsStatement(node As SyntaxNode) As Boolean\n Return TypeOf node Is StatementSyntax\n End Function\n\n Public Overrides Function IsExecutableStatement(node As SyntaxNode) As Boolean\n Return TypeOf node Is ExecutableStatementSyntax\n End Function\n\n Public Overrides Function IsMethodBody(node As SyntaxNode) As Boolean\n Return TypeOf node Is MethodBlockBaseSyntax\n End Function\n\n Public Overrides Function GetExpressionOfReturnStatement(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, ReturnStatementSyntax).Expression\n End Function\n\n Public Overrides Function IsThisConstructorInitializer(token As SyntaxToken) As Boolean\n If TypeOf token.Parent Is IdentifierNameSyntax AndAlso token.HasMatchingText(SyntaxKind.NewKeyword) Then\n Dim memberAccess = TryCast(token.Parent.Parent, MemberAccessExpressionSyntax)\n Return memberAccess.IsThisConstructorInitializer()\n End If\n\n Return False\n End Function\n\n Public Overrides Function IsBaseConstructorInitializer(token As SyntaxToken) As Boolean\n If TypeOf token.Parent Is IdentifierNameSyntax AndAlso token.HasMatchingText(SyntaxKind.NewKeyword) Then\n Dim memberAccess = TryCast(token.Parent.Parent, MemberAccessExpressionSyntax)\n Return memberAccess.IsBaseConstructorInitializer()\n End If\n\n Return False\n End Function\n\n Public Overrides Function IsQueryKeyword(token As SyntaxToken) As Boolean\n Select Case token.Kind()\n Case _\n SyntaxKind.JoinKeyword,\n SyntaxKind.IntoKeyword,\n SyntaxKind.AggregateKeyword,\n SyntaxKind.DistinctKeyword,\n SyntaxKind.SkipKeyword,\n SyntaxKind.TakeKeyword,\n SyntaxKind.LetKeyword,\n SyntaxKind.ByKeyword,\n SyntaxKind.OrderKeyword,\n SyntaxKind.WhereKeyword,\n SyntaxKind.OnKeyword,\n SyntaxKind.FromKeyword,\n SyntaxKind.WhileKeyword,\n SyntaxKind.SelectKeyword\n Return TypeOf token.Parent Is QueryClauseSyntax\n Case SyntaxKind.GroupKeyword\n Return (TypeOf token.Parent Is QueryClauseSyntax) OrElse (token.Parent.IsKind(SyntaxKind.GroupAggregation))\n Case SyntaxKind.EqualsKeyword\n Return TypeOf token.Parent Is JoinConditionSyntax\n Case SyntaxKind.AscendingKeyword, SyntaxKind.DescendingKeyword\n Return TypeOf token.Parent Is OrderingSyntax\n Case SyntaxKind.InKeyword\n Return TypeOf token.Parent Is CollectionRangeVariableSyntax\n Case Else\n Return False\n End Select\n End Function\n\n Public Overrides Function IsPredefinedType(token As SyntaxToken) As Boolean\n Dim actualType As PredefinedType = PredefinedType.None\n Return TryGetPredefinedType(token, actualType) AndAlso actualType <> PredefinedType.None\n End Function\n\n Public Overrides Function IsPredefinedType(token As SyntaxToken, type As PredefinedType) As Boolean\n Dim actualType As PredefinedType = PredefinedType.None\n Return TryGetPredefinedType(token, actualType) AndAlso actualType = type\n End Function\n\n Public Overrides Function TryGetPredefinedType(token As SyntaxToken, ByRef type As PredefinedType) As Boolean\n type = GetPredefinedType(token)\n Return type <> PredefinedType.None\n End Function\n\n Private Shared Function GetPredefinedType(token As SyntaxToken) As PredefinedType\n Select Case token.Kind\n Case SyntaxKind.BooleanKeyword\n Return PredefinedType.Boolean\n Case SyntaxKind.ByteKeyword\n Return PredefinedType.Byte\n Case SyntaxKind.SByteKeyword\n Return PredefinedType.SByte\n Case SyntaxKind.IntegerKeyword\n Return PredefinedType.Int32\n Case SyntaxKind.UIntegerKeyword\n Return PredefinedType.UInt32\n Case SyntaxKind.ShortKeyword\n Return PredefinedType.Int16\n Case SyntaxKind.UShortKeyword\n Return PredefinedType.UInt16\n Case SyntaxKind.LongKeyword\n Return PredefinedType.Int64\n Case SyntaxKind.ULongKeyword\n Return PredefinedType.UInt64\n Case SyntaxKind.SingleKeyword\n Return PredefinedType.Single\n Case SyntaxKind.DoubleKeyword\n Return PredefinedType.Double\n Case SyntaxKind.DecimalKeyword\n Return PredefinedType.Decimal\n Case SyntaxKind.StringKeyword\n Return PredefinedType.String\n Case SyntaxKind.CharKeyword\n Return PredefinedType.Char\n Case SyntaxKind.ObjectKeyword\n Return PredefinedType.Object\n Case SyntaxKind.DateKeyword\n Return PredefinedType.DateTime\n Case Else\n Return PredefinedType.None\n End Select\n End Function\n\n Public Overrides Function IsPredefinedOperator(token As SyntaxToken) As Boolean\n Dim actualOp As PredefinedOperator = PredefinedOperator.None\n Return TryGetPredefinedOperator(token, actualOp) AndAlso actualOp <> PredefinedOperator.None\n End Function\n\n Public Overrides Function IsPredefinedOperator(token As SyntaxToken, op As PredefinedOperator) As Boolean\n Dim actualOp As PredefinedOperator = PredefinedOperator.None\n Return TryGetPredefinedOperator(token, actualOp) AndAlso actualOp = op\n End Function\n\n Public Overrides Function TryGetPredefinedOperator(token As SyntaxToken, ByRef op As PredefinedOperator) As Boolean\n op = GetPredefinedOperator(token)\n Return op <> PredefinedOperator.None\n End Function\n\n Private Shared Function GetPredefinedOperator(token As SyntaxToken) As PredefinedOperator\n Select Case token.Kind\n Case SyntaxKind.PlusToken, SyntaxKind.PlusEqualsToken\n Return PredefinedOperator.Addition\n\n Case SyntaxKind.MinusToken, SyntaxKind.MinusEqualsToken\n Return PredefinedOperator.Subtraction\n\n Case SyntaxKind.AndKeyword, SyntaxKind.AndAlsoKeyword\n Return PredefinedOperator.BitwiseAnd\n\n Case SyntaxKind.OrKeyword, SyntaxKind.OrElseKeyword\n Return PredefinedOperator.BitwiseOr\n\n Case SyntaxKind.AmpersandToken, SyntaxKind.AmpersandEqualsToken\n Return PredefinedOperator.Concatenate\n\n Case SyntaxKind.SlashToken, SyntaxKind.SlashEqualsToken\n Return PredefinedOperator.Division\n\n Case SyntaxKind.EqualsToken\n Return PredefinedOperator.Equality\n\n Case SyntaxKind.XorKeyword\n Return PredefinedOperator.ExclusiveOr\n\n Case SyntaxKind.CaretToken, SyntaxKind.CaretEqualsToken\n Return PredefinedOperator.Exponent\n\n Case SyntaxKind.GreaterThanToken\n Return PredefinedOperator.GreaterThan\n\n Case SyntaxKind.GreaterThanEqualsToken\n Return PredefinedOperator.GreaterThanOrEqual\n\n Case SyntaxKind.LessThanGreaterThanToken\n Return PredefinedOperator.Inequality\n\n Case SyntaxKind.BackslashToken, SyntaxKind.BackslashEqualsToken\n Return PredefinedOperator.IntegerDivision\n\n Case SyntaxKind.LessThanLessThanToken, SyntaxKind.LessThanLessThanEqualsToken\n Return PredefinedOperator.LeftShift\n\n Case SyntaxKind.LessThanToken\n Return PredefinedOperator.LessThan\n\n Case SyntaxKind.LessThanEqualsToken\n Return PredefinedOperator.LessThanOrEqual\n\n Case SyntaxKind.LikeKeyword\n Return PredefinedOperator.Like\n\n Case SyntaxKind.NotKeyword\n Return PredefinedOperator.Complement\n\n Case SyntaxKind.ModKeyword\n Return PredefinedOperator.Modulus\n\n Case SyntaxKind.AsteriskToken, SyntaxKind.AsteriskEqualsToken\n Return PredefinedOperator.Multiplication\n\n Case SyntaxKind.GreaterThanGreaterThanToken, SyntaxKind.GreaterThanGreaterThanEqualsToken\n Return PredefinedOperator.RightShift\n\n Case Else\n Return PredefinedOperator.None\n End Select\n End Function\n\n Public Overrides Function GetText(kind As Integer) As String\n Return SyntaxFacts.GetText(CType(kind, SyntaxKind))\n End Function\n\n Public Overrides Function IsIdentifierPartCharacter(c As Char) As Boolean\n Return SyntaxFacts.IsIdentifierPartCharacter(c)\n End Function\n\n Public Overrides Function IsIdentifierStartCharacter(c As Char) As Boolean\n Return SyntaxFacts.IsIdentifierStartCharacter(c)\n End Function\n\n Public Overrides Function IsIdentifierEscapeCharacter(c As Char) As Boolean\n Return c = \"[\"c OrElse c = \"]\"c\n End Function\n\n Public Overrides Function IsValidIdentifier(identifier As String) As Boolean\n Dim token = SyntaxFactory.ParseToken(identifier)\n ' TODO: There is no way to get the diagnostics to see if any are actually errors?\n Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length\n End Function\n\n Public Overrides Function IsVerbatimIdentifier(identifier As String) As Boolean\n Return IsValidIdentifier(identifier) AndAlso MakeHalfWidthIdentifier(identifier.First()) = \"[\" AndAlso MakeHalfWidthIdentifier(identifier.Last()) = \"]\"\n End Function\n\n Public Overrides Function IsTypeCharacter(c As Char) As Boolean\n Return c = \"%\"c OrElse\n c = \"&\"c OrElse\n c = \"@\"c OrElse\n c = \"!\"c OrElse\n c = \"#\"c OrElse\n c = \"$\"c\n End Function\n\n Public Overrides Function IsStartOfUnicodeEscapeSequence(c As Char) As Boolean\n Return False ' VB does not support identifiers with escaped unicode characters\n End Function\n\n Public Overrides Function IsLiteral(token As SyntaxToken) As Boolean\n Select Case token.Kind()\n Case _\n SyntaxKind.IntegerLiteralToken,\n SyntaxKind.CharacterLiteralToken,\n SyntaxKind.DecimalLiteralToken,\n SyntaxKind.FloatingLiteralToken,\n SyntaxKind.DateLiteralToken,\n SyntaxKind.StringLiteralToken,\n SyntaxKind.DollarSignDoubleQuoteToken,\n SyntaxKind.DoubleQuoteToken,\n SyntaxKind.InterpolatedStringTextToken,\n SyntaxKind.TrueKeyword,\n SyntaxKind.FalseKeyword,\n SyntaxKind.NothingKeyword\n Return True\n End Select\n\n Return False\n End Function\n\n Public Overrides Function IsStringLiteralOrInterpolatedStringLiteral(token As SyntaxToken) As Boolean\n Return token.IsKind(SyntaxKind.StringLiteralToken, SyntaxKind.InterpolatedStringTextToken)\n End Function\n\n Public Overrides Function IsBindableToken(token As Microsoft.CodeAnalysis.SyntaxToken) As Boolean\n Return Me.IsWord(token) OrElse\n Me.IsLiteral(token) OrElse\n Me.IsOperator(token)\n End Function\n\n Public Overrides Function IsPointerMemberAccessExpression(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Sub GetNameAndArityOfSimpleName(node As SyntaxNode, ByRef name As String, ByRef arity As Integer)\n Dim simpleName = DirectCast(node, SimpleNameSyntax)\n name = simpleName.Identifier.ValueText\n arity = simpleName.Arity\n End Sub\n\n Public Overrides Function LooksGeneric(name As SyntaxNode) As Boolean\n Return name.IsKind(SyntaxKind.GenericName)\n End Function\n\n Public Overrides Function GetExpressionOfMemberAccessExpression(node As SyntaxNode, Optional allowImplicitTarget As Boolean = False) As SyntaxNode\n Return TryCast(node, MemberAccessExpressionSyntax)?.GetExpressionOfMemberAccessExpression(allowImplicitTarget)\n End Function\n\n Public Overrides Function GetTargetOfMemberBinding(node As SyntaxNode) As SyntaxNode\n ' Member bindings are a C# concept.\n Return Nothing\n End Function\n\n Public Overrides Function GetNameOfMemberBindingExpression(node As SyntaxNode) As SyntaxNode\n ' Member bindings are a C# concept.\n Return Nothing\n End Function\n\n Public Overrides Sub GetPartsOfElementAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef argumentList As SyntaxNode)\n Dim invocation = TryCast(node, InvocationExpressionSyntax)\n If invocation IsNot Nothing Then\n expression = invocation?.Expression\n argumentList = invocation?.ArgumentList\n Return\n End If\n\n If node.Kind() = SyntaxKind.DictionaryAccessExpression Then\n GetPartsOfMemberAccessExpression(node, expression, argumentList)\n Return\n End If\n\n Throw ExceptionUtilities.UnexpectedValue(node.Kind())\n End Sub\n\n Public Overrides Function GetExpressionOfInterpolation(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, InterpolationSyntax).Expression\n End Function\n\n Public Overrides Function IsInNamespaceOrTypeContext(node As SyntaxNode) As Boolean\n Return SyntaxFacts.IsInNamespaceOrTypeContext(node)\n End Function\n\n Public Overrides Function IsBaseTypeList(node As SyntaxNode) As Boolean\n Return TryCast(node, InheritsOrImplementsStatementSyntax) IsNot Nothing\n End Function\n\n Public Overrides Function IsInStaticContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean\n Return node.IsInStaticContext()\n End Function\n\n Public Overrides Function GetExpressionOfArgument(node As Microsoft.CodeAnalysis.SyntaxNode) As Microsoft.CodeAnalysis.SyntaxNode\n Return DirectCast(node, ArgumentSyntax).GetArgumentExpression()\n End Function\n\n Public Overrides Function GetRefKindOfArgument(node As Microsoft.CodeAnalysis.SyntaxNode) As Microsoft.CodeAnalysis.RefKind\n ' TODO(cyrusn): Consider the method this argument is passed to, to determine this.\n Return RefKind.None\n End Function\n\n Public Overrides Function IsArgument(node As SyntaxNode) As Boolean\n Return TypeOf node Is ArgumentSyntax\n End Function\n\n Public Overrides Function IsSimpleArgument(node As SyntaxNode) As Boolean\n Dim argument = TryCast(node, ArgumentSyntax)\n Return argument IsNot Nothing AndAlso Not argument.IsNamed AndAlso Not argument.IsOmitted\n End Function\n\n Public Overrides Function IsInConstantContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean\n Return node.IsInConstantContext()\n End Function\n\n Public Overrides Function IsInConstructor(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean\n Return node.GetAncestors(Of StatementSyntax).Any(Function(s) s.Kind = SyntaxKind.ConstructorBlock)\n End Function\n\n Public Overrides Function IsUnsafeContext(node As Microsoft.CodeAnalysis.SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function GetNameOfAttribute(node As SyntaxNode) As Microsoft.CodeAnalysis.SyntaxNode\n Return DirectCast(node, AttributeSyntax).Name\n End Function\n\n Public Overrides Function IsAttributeNamedArgumentIdentifier(node As SyntaxNode) As Boolean\n Dim identifierName = TryCast(node, IdentifierNameSyntax)\n Return identifierName.IsParentKind(SyntaxKind.NameColonEquals) AndAlso\n identifierName.Parent.IsParentKind(SyntaxKind.SimpleArgument) AndAlso\n identifierName.Parent.Parent.IsParentKind(SyntaxKind.ArgumentList) AndAlso\n identifierName.Parent.Parent.Parent.IsParentKind(SyntaxKind.Attribute)\n End Function\n\n Public Overrides Function GetContainingTypeDeclaration(root As SyntaxNode, position As Integer) As SyntaxNode\n If root Is Nothing Then\n Throw New ArgumentNullException(NameOf(root))\n End If\n\n If position < 0 OrElse position > root.Span.End Then\n Throw New ArgumentOutOfRangeException(NameOf(position))\n End If\n\n Return root.\n FindToken(position).\n GetAncestors(Of SyntaxNode)().\n FirstOrDefault(Function(n) TypeOf n Is TypeBlockSyntax OrElse TypeOf n Is DelegateStatementSyntax)\n End Function\n\n Public Overrides Function GetContainingVariableDeclaratorOfFieldDeclaration(node As SyntaxNode) As SyntaxNode\n If node Is Nothing Then\n Throw New ArgumentNullException(NameOf(node))\n End If\n\n Dim parent = node.Parent\n\n While node IsNot Nothing\n If node.Kind = SyntaxKind.VariableDeclarator AndAlso node.IsParentKind(SyntaxKind.FieldDeclaration) Then\n Return node\n End If\n\n node = node.Parent\n End While\n\n Return Nothing\n End Function\n\n Public Overrides Function IsMemberInitializerNamedAssignmentIdentifier(node As SyntaxNode) As Boolean\n Dim unused As SyntaxNode = Nothing\n Return IsMemberInitializerNamedAssignmentIdentifier(node, unused)\n End Function\n\n Public Overrides Function IsMemberInitializerNamedAssignmentIdentifier(\n node As SyntaxNode,\n ByRef initializedInstance As SyntaxNode) As Boolean\n\n Dim identifier = TryCast(node, IdentifierNameSyntax)\n If identifier?.IsChildNode(Of NamedFieldInitializerSyntax)(Function(n) n.Name) Then\n ' .parent is the NamedField.\n ' .parent.parent is the ObjectInitializer.\n ' .parent.parent.parent will be the ObjectCreationExpression.\n initializedInstance = identifier.Parent.Parent.Parent\n Return True\n End If\n\n Return False\n End Function\n\n Public Overrides Function IsNameOfSubpattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsPropertyPatternClause(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsElementAccessExpression(node As SyntaxNode) As Boolean\n ' VB doesn't have a specialized node for element access. Instead, it just uses an\n ' invocation expression or dictionary access expression.\n Return node.Kind = SyntaxKind.InvocationExpression OrElse node.Kind = SyntaxKind.DictionaryAccessExpression\n End Function\n\n Public Overrides Function IsIndexerMemberCRef(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function GetContainingMemberDeclaration(root As SyntaxNode, position As Integer, Optional useFullSpan As Boolean = True) As SyntaxNode\n Contract.ThrowIfNull(root, NameOf(root))\n Contract.ThrowIfTrue(position < 0 OrElse position > root.FullSpan.End, NameOf(position))\n\n Dim [end] = root.FullSpan.End\n If [end] = 0 Then\n ' empty file\n Return Nothing\n End If\n\n ' make sure position doesn't touch end of root\n position = Math.Min(position, [end] - 1)\n\n Dim node = root.FindToken(position).Parent\n While node IsNot Nothing\n If useFullSpan OrElse node.Span.Contains(position) Then\n\n If TypeOf node Is MethodBlockBaseSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is MethodBaseSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return node\n End If\n\n If TypeOf node Is PropertyStatementSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is EventStatementSyntax AndAlso Not TypeOf node.Parent Is EventBlockSyntax Then\n Return node\n End If\n\n If TypeOf node Is PropertyBlockSyntax OrElse\n TypeOf node Is TypeBlockSyntax OrElse\n TypeOf node Is EnumBlockSyntax OrElse\n TypeOf node Is NamespaceBlockSyntax OrElse\n TypeOf node Is EventBlockSyntax OrElse\n TypeOf node Is FieldDeclarationSyntax Then\n Return node\n End If\n End If\n\n node = node.Parent\n End While\n\n Return Nothing\n End Function\n\n Public Overrides Function IsMethodLevelMember(node As SyntaxNode) As Boolean\n\n ' Note: Derived types of MethodBaseSyntax are expanded explicitly, since PropertyStatementSyntax and\n ' EventStatementSyntax will NOT be parented by MethodBlockBaseSyntax. Additionally, there are things\n ' like AccessorStatementSyntax and DelegateStatementSyntax that we never want to tread as method level\n ' members.\n\n If TypeOf node Is MethodStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is SubNewStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is OperatorStatementSyntax AndAlso Not TypeOf node.Parent Is MethodBlockBaseSyntax Then\n Return True\n End If\n\n If TypeOf node Is PropertyStatementSyntax AndAlso Not TypeOf node.Parent Is PropertyBlockSyntax Then\n Return True\n End If\n\n If TypeOf node Is EventStatementSyntax AndAlso Not TypeOf node.Parent Is EventBlockSyntax Then\n Return True\n End If\n\n If TypeOf node Is DeclareStatementSyntax Then\n Return True\n End If\n\n Return TypeOf node Is ConstructorBlockSyntax OrElse\n TypeOf node Is MethodBlockSyntax OrElse\n TypeOf node Is OperatorBlockSyntax OrElse\n TypeOf node Is EventBlockSyntax OrElse\n TypeOf node Is PropertyBlockSyntax OrElse\n TypeOf node Is EnumMemberDeclarationSyntax OrElse\n TypeOf node Is FieldDeclarationSyntax\n End Function\n\n Public Overrides Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan\n Dim member = GetContainingMemberDeclaration(node, node.SpanStart)\n If member Is Nothing Then\n Return Nothing\n End If\n\n ' TODO: currently we only support method for now\n Dim method = TryCast(member, MethodBlockBaseSyntax)\n If method IsNot Nothing Then\n If method.BlockStatement Is Nothing OrElse method.EndBlockStatement Is Nothing Then\n Return Nothing\n End If\n\n ' We don't want to include the BlockStatement or any trailing trivia up to and including its statement\n ' terminator in the span. Instead, we use the start of the first statement's leading trivia (if any) up\n ' to the start of the EndBlockStatement. If there aren't any statements in the block, we use the start\n ' of the EndBlockStatements leading trivia.\n\n Dim firstStatement = method.Statements.FirstOrDefault()\n Dim spanStart = If(firstStatement IsNot Nothing,\n firstStatement.FullSpan.Start,\n method.EndBlockStatement.FullSpan.Start)\n\n Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart)\n End If\n\n Return Nothing\n End Function\n\n Public Overrides Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean\n Dim method = TryCast(node, MethodBlockBaseSyntax)\n If method IsNot Nothing Then\n Return method.Statements.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan(method.Statements), span)\n End If\n\n Dim [event] = TryCast(node, EventBlockSyntax)\n If [event] IsNot Nothing Then\n Return [event].Accessors.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan([event].Accessors), span)\n End If\n\n Dim [property] = TryCast(node, PropertyBlockSyntax)\n If [property] IsNot Nothing Then\n Return [property].Accessors.Count > 0 AndAlso ContainsExclusively(GetSyntaxListSpan([property].Accessors), span)\n End If\n\n Dim field = TryCast(node, FieldDeclarationSyntax)\n If field IsNot Nothing Then\n Return field.Declarators.Count > 0 AndAlso ContainsExclusively(GetSeparatedSyntaxListSpan(field.Declarators), span)\n End If\n\n Dim [enum] = TryCast(node, EnumMemberDeclarationSyntax)\n If [enum] IsNot Nothing Then\n Return [enum].Initializer IsNot Nothing AndAlso ContainsExclusively([enum].Initializer.Span, span)\n End If\n\n Dim propStatement = TryCast(node, PropertyStatementSyntax)\n If propStatement IsNot Nothing Then\n Return propStatement.Initializer IsNot Nothing AndAlso ContainsExclusively(propStatement.Initializer.Span, span)\n End If\n\n Return False\n End Function\n\n Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean\n If innerSpan.IsEmpty Then\n Return outerSpan.Contains(innerSpan.Start)\n End If\n\n Return outerSpan.Contains(innerSpan)\n End Function\n\n Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan\n Debug.Assert(list.Count > 0)\n Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)\n End Function\n\n Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan\n Debug.Assert(list.Count > 0)\n Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)\n End Function\n\n Public Overrides Function GetTopLevelAndMethodLevelMembers(root As SyntaxNode) As List(Of SyntaxNode)\n Dim list = New List(Of SyntaxNode)()\n AppendMembers(root, list, topLevel:=True, methodLevel:=True)\n Return list\n End Function\n\n Public Overrides Function GetMethodLevelMembers(root As SyntaxNode) As List(Of SyntaxNode)\n Dim list = New List(Of SyntaxNode)()\n AppendMembers(root, list, topLevel:=False, methodLevel:=True)\n Return list\n End Function\n\n Public Overrides Function GetMembersOfTypeDeclaration(typeDeclaration As SyntaxNode) As SyntaxList(Of SyntaxNode)\n Return DirectCast(typeDeclaration, TypeBlockSyntax).Members\n End Function\n\n Public Overrides Function IsTopLevelNodeWithMembers(node As SyntaxNode) As Boolean\n Return TypeOf node Is NamespaceBlockSyntax OrElse\n TypeOf node Is TypeBlockSyntax OrElse\n TypeOf node Is EnumBlockSyntax\n End Function\n\n Private Const s_dotToken As String = \".\"\n\n Public Overrides Function GetDisplayName(node As SyntaxNode, options As DisplayNameOptions, Optional rootNamespace As String = Nothing) As String\n If node Is Nothing Then\n Return String.Empty\n End If\n\n Dim pooled = PooledStringBuilder.GetInstance()\n Dim builder = pooled.Builder\n\n ' member keyword (if any)\n Dim memberDeclaration = TryCast(node, DeclarationStatementSyntax)\n If (options And DisplayNameOptions.IncludeMemberKeyword) <> 0 Then\n Dim keywordToken = memberDeclaration.GetMemberKeywordToken()\n If keywordToken <> Nothing AndAlso Not keywordToken.IsMissing Then\n builder.Append(keywordToken.Text)\n builder.Append(\" \"c)\n End If\n End If\n\n Dim names = ArrayBuilder(Of String).GetInstance()\n ' containing type(s)\n Dim parent = node.Parent\n While TypeOf parent Is TypeBlockSyntax\n names.Push(GetName(parent, options, containsGlobalKeyword:=False))\n parent = parent.Parent\n End While\n\n If (options And DisplayNameOptions.IncludeNamespaces) <> 0 Then\n ' containing namespace(s) in source (if any)\n Dim containsGlobalKeyword As Boolean = False\n While parent IsNot Nothing AndAlso parent.Kind() = SyntaxKind.NamespaceBlock\n names.Push(GetName(parent, options, containsGlobalKeyword))\n parent = parent.Parent\n End While\n ' root namespace (if any)\n If Not containsGlobalKeyword AndAlso Not String.IsNullOrEmpty(rootNamespace) Then\n builder.Append(rootNamespace)\n builder.Append(s_dotToken)\n End If\n End If\n\n While Not names.IsEmpty()\n Dim name = names.Pop()\n If name IsNot Nothing Then\n builder.Append(name)\n builder.Append(s_dotToken)\n End If\n End While\n\n names.Free()\n\n ' name (include generic type parameters)\n builder.Append(GetName(node, options, containsGlobalKeyword:=False))\n\n ' parameter list (if any)\n If (options And DisplayNameOptions.IncludeParameters) <> 0 Then\n builder.Append(memberDeclaration.GetParameterList())\n End If\n\n ' As clause (if any)\n If (options And DisplayNameOptions.IncludeType) <> 0 Then\n Dim asClause = memberDeclaration.GetAsClause()\n If asClause IsNot Nothing Then\n builder.Append(\" \"c)\n builder.Append(asClause)\n End If\n End If\n\n Return pooled.ToStringAndFree()\n End Function\n\n Private Shared Function GetName(node As SyntaxNode, options As DisplayNameOptions, ByRef containsGlobalKeyword As Boolean) As String\n Const missingTokenPlaceholder As String = \"?\"\n\n Select Case node.Kind()\n Case SyntaxKind.CompilationUnit\n Return Nothing\n Case SyntaxKind.IdentifierName\n Dim identifier = DirectCast(node, IdentifierNameSyntax).Identifier\n Return If(identifier.IsMissing, missingTokenPlaceholder, identifier.Text)\n Case SyntaxKind.IncompleteMember\n Return missingTokenPlaceholder\n Case SyntaxKind.NamespaceBlock\n Dim nameSyntax = CType(node, NamespaceBlockSyntax).NamespaceStatement.Name\n If nameSyntax.Kind() = SyntaxKind.GlobalName Then\n containsGlobalKeyword = True\n Return Nothing\n Else\n Return GetName(nameSyntax, options, containsGlobalKeyword)\n End If\n Case SyntaxKind.QualifiedName\n Dim qualified = CType(node, QualifiedNameSyntax)\n If qualified.Left.Kind() = SyntaxKind.GlobalName Then\n containsGlobalKeyword = True\n Return GetName(qualified.Right, options, containsGlobalKeyword) ' don't use the Global prefix if specified\n Else\n Return GetName(qualified.Left, options, containsGlobalKeyword) + s_dotToken + GetName(qualified.Right, options, containsGlobalKeyword)\n End If\n End Select\n\n Dim name As String = Nothing\n Dim memberDeclaration = TryCast(node, DeclarationStatementSyntax)\n If memberDeclaration IsNot Nothing Then\n Dim nameToken = memberDeclaration.GetNameToken()\n If nameToken <> Nothing Then\n name = If(nameToken.IsMissing, missingTokenPlaceholder, nameToken.Text)\n If (options And DisplayNameOptions.IncludeTypeParameters) <> 0 Then\n Dim pooled = PooledStringBuilder.GetInstance()\n Dim builder = pooled.Builder\n builder.Append(name)\n AppendTypeParameterList(builder, memberDeclaration.GetTypeParameterList())\n name = pooled.ToStringAndFree()\n End If\n End If\n End If\n\n Debug.Assert(name IsNot Nothing, \"Unexpected node type \" + node.Kind().ToString())\n Return name\n End Function\n\n Private Shared Sub AppendTypeParameterList(builder As StringBuilder, typeParameterList As TypeParameterListSyntax)\n If typeParameterList IsNot Nothing AndAlso typeParameterList.Parameters.Count > 0 Then\n builder.Append(\"(Of \")\n builder.Append(typeParameterList.Parameters(0).Identifier.Text)\n For i = 1 To typeParameterList.Parameters.Count - 1\n builder.Append(\", \")\n builder.Append(typeParameterList.Parameters(i).Identifier.Text)\n Next\n\n builder.Append(\")\"c)\n End If\n End Sub\n\n Private Sub AppendMembers(node As SyntaxNode, list As List(Of SyntaxNode), topLevel As Boolean, methodLevel As Boolean)\n Debug.Assert(topLevel OrElse methodLevel)\n\n For Each member In node.GetMembers()\n If IsTopLevelNodeWithMembers(member) Then\n If topLevel Then\n list.Add(member)\n End If\n\n AppendMembers(member, list, topLevel, methodLevel)\n Continue For\n End If\n\n If methodLevel AndAlso IsMethodLevelMember(member) Then\n list.Add(member)\n End If\n Next\n End Sub\n\n Public Overrides Function TryGetBindableParent(token As SyntaxToken) As SyntaxNode\n Dim node = token.Parent\n While node IsNot Nothing\n Dim parent = node.Parent\n\n ' If this node is on the left side of a member access expression, don't ascend\n ' further or we'll end up binding to something else.\n Dim memberAccess = TryCast(parent, MemberAccessExpressionSyntax)\n If memberAccess IsNot Nothing Then\n If memberAccess.Expression Is node Then\n Exit While\n End If\n End If\n\n ' If this node is on the left side of a qualified name, don't ascend\n ' further or we'll end up binding to something else.\n Dim qualifiedName = TryCast(parent, QualifiedNameSyntax)\n If qualifiedName IsNot Nothing Then\n If qualifiedName.Left Is node Then\n Exit While\n End If\n End If\n\n ' If this node is the type of an object creation expression, return the\n ' object creation expression.\n Dim objectCreation = TryCast(parent, ObjectCreationExpressionSyntax)\n If objectCreation IsNot Nothing Then\n If objectCreation.Type Is node Then\n node = parent\n Exit While\n End If\n End If\n\n ' The inside of an interpolated string is treated as its own token so we\n ' need to force navigation to the parent expression syntax.\n If TypeOf node Is InterpolatedStringTextSyntax AndAlso TypeOf parent Is InterpolatedStringExpressionSyntax Then\n node = parent\n Exit While\n End If\n\n ' If this node is not parented by a name, we're done.\n Dim name = TryCast(parent, NameSyntax)\n If name Is Nothing Then\n Exit While\n End If\n\n node = parent\n End While\n\n Return node\n End Function\n\n Public Overrides Function GetConstructors(root As SyntaxNode, cancellationToken As CancellationToken) As IEnumerable(Of SyntaxNode)\n Dim compilationUnit = TryCast(root, CompilationUnitSyntax)\n If compilationUnit Is Nothing Then\n Return SpecializedCollections.EmptyEnumerable(Of SyntaxNode)()\n End If\n\n Dim constructors = New List(Of SyntaxNode)()\n AppendConstructors(compilationUnit.Members, constructors, cancellationToken)\n Return constructors\n End Function\n\n Private Sub AppendConstructors(members As SyntaxList(Of StatementSyntax), constructors As List(Of SyntaxNode), cancellationToken As CancellationToken)\n For Each member As StatementSyntax In members\n cancellationToken.ThrowIfCancellationRequested()\n\n Dim constructor = TryCast(member, ConstructorBlockSyntax)\n If constructor IsNot Nothing Then\n constructors.Add(constructor)\n Continue For\n End If\n\n Dim [namespace] = TryCast(member, NamespaceBlockSyntax)\n If [namespace] IsNot Nothing Then\n AppendConstructors([namespace].Members, constructors, cancellationToken)\n End If\n\n Dim [class] = TryCast(member, ClassBlockSyntax)\n If [class] IsNot Nothing Then\n AppendConstructors([class].Members, constructors, cancellationToken)\n End If\n\n Dim [struct] = TryCast(member, StructureBlockSyntax)\n If [struct] IsNot Nothing Then\n AppendConstructors([struct].Members, constructors, cancellationToken)\n End If\n Next\n End Sub\n\n Public Overrides Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan\n Dim trivia = tree.FindTriviaToLeft(position, cancellationToken)\n If trivia.Kind = SyntaxKind.DisabledTextTrivia Then\n Return trivia.FullSpan\n End If\n\n Return Nothing\n End Function\n\n Public Overrides Function GetNameForArgument(argument As SyntaxNode) As String\n If TryCast(argument, ArgumentSyntax)?.IsNamed Then\n Return DirectCast(argument, SimpleArgumentSyntax).NameColonEquals.Name.Identifier.ValueText\n End If\n\n Return String.Empty\n End Function\n\n Public Overrides Function GetNameForAttributeArgument(argument As SyntaxNode) As String\n ' All argument types are ArgumentSyntax in VB.\n Return GetNameForArgument(argument)\n End Function\n\n Public Overrides Function IsLeftSideOfDot(node As SyntaxNode) As Boolean\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfDot()\n End Function\n\n Public Overrides Function GetRightSideOfDot(node As SyntaxNode) As SyntaxNode\n Return If(TryCast(node, QualifiedNameSyntax)?.Right,\n TryCast(node, MemberAccessExpressionSyntax)?.Name)\n End Function\n\n Public Overrides Function GetLeftSideOfDot(node As SyntaxNode, Optional allowImplicitTarget As Boolean = False) As SyntaxNode\n Return If(TryCast(node, QualifiedNameSyntax)?.Left,\n TryCast(node, MemberAccessExpressionSyntax)?.GetExpressionOfMemberAccessExpression(allowImplicitTarget))\n End Function\n\n Public Overrides Function IsLeftSideOfExplicitInterfaceSpecifier(node As SyntaxNode) As Boolean\n Return IsLeftSideOfDot(node) AndAlso TryCast(node.Parent.Parent, ImplementsClauseSyntax) IsNot Nothing\n End Function\n\n Public Overrides Function IsLeftSideOfAssignment(node As SyntaxNode) As Boolean\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfSimpleAssignmentStatement\n End Function\n\n Public Overrides Function IsLeftSideOfAnyAssignment(node As SyntaxNode) As Boolean\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfAnyAssignmentStatement\n End Function\n\n Public Overrides Function IsLeftSideOfCompoundAssignment(node As SyntaxNode) As Boolean\n Return TryCast(node, ExpressionSyntax).IsLeftSideOfCompoundAssignmentStatement\n End Function\n\n Public Overrides Function GetRightHandSideOfAssignment(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, AssignmentStatementSyntax).Right\n End Function\n\n Public Overrides Function IsInferredAnonymousObjectMemberDeclarator(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.InferredFieldInitializer)\n End Function\n\n Public Overrides Function IsOperandOfIncrementExpression(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsOperandOfIncrementOrDecrementExpression(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function GetContentsOfInterpolatedString(interpolatedString As SyntaxNode) As SyntaxList(Of SyntaxNode)\n Return (TryCast(interpolatedString, InterpolatedStringExpressionSyntax)?.Contents).Value\n End Function\n\n Public Overrides Function IsNumericLiteral(token As SyntaxToken) As Boolean\n Return token.Kind = SyntaxKind.DecimalLiteralToken OrElse\n token.Kind = SyntaxKind.FloatingLiteralToken OrElse\n token.Kind = SyntaxKind.IntegerLiteralToken\n End Function\n\n Public Overrides Function IsVerbatimStringLiteral(token As SyntaxToken) As Boolean\n ' VB does not have verbatim strings\n Return False\n End Function\n\n Public Overrides Function GetArgumentsOfInvocationExpression(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode)\n Dim argumentList = DirectCast(node, InvocationExpressionSyntax).ArgumentList\n Return If(argumentList Is Nothing, Nothing, GetArgumentsOfArgumentList(argumentList))\n End Function\n\n Public Overrides Function GetArgumentsOfObjectCreationExpression(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode)\n Dim argumentList = DirectCast(node, ObjectCreationExpressionSyntax).ArgumentList\n Return If(argumentList Is Nothing, Nothing, GetArgumentsOfArgumentList(argumentList))\n End Function\n\n Public Overrides Function GetArgumentsOfArgumentList(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode)\n Return DirectCast(node, ArgumentListSyntax).Arguments\n End Function\n\n Public Overrides Function ConvertToSingleLine(node As SyntaxNode, Optional useElasticTrivia As Boolean = False) As SyntaxNode\n Return node.ConvertToSingleLine(useElasticTrivia)\n End Function\n\n Public Overrides Function IsDocumentationComment(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.DocumentationCommentTrivia)\n End Function\n\n Public Overrides Function IsUsingOrExternOrImport(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.ImportsStatement)\n End Function\n\n Public Overrides Function IsGlobalAssemblyAttribute(node As SyntaxNode) As Boolean\n Return IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword)\n End Function\n\n Public Overrides Function IsGlobalModuleAttribute(node As SyntaxNode) As Boolean\n Return IsGlobalAttribute(node, SyntaxKind.ModuleKeyword)\n End Function\n\n Private Shared Function IsGlobalAttribute(node As SyntaxNode, attributeTarget As SyntaxKind) As Boolean\n If node.IsKind(SyntaxKind.Attribute) Then\n Dim attributeNode = CType(node, AttributeSyntax)\n If attributeNode.Target IsNot Nothing Then\n Return attributeNode.Target.AttributeModifier.IsKind(attributeTarget)\n End If\n End If\n\n Return False\n End Function\n\n Public Overrides Function IsDeclaration(node As SyntaxNode) As Boolean\n ' From the Visual Basic language spec:\n ' NamespaceMemberDeclaration :=\n ' NamespaceDeclaration |\n ' TypeDeclaration\n ' TypeDeclaration ::=\n ' ModuleDeclaration |\n ' NonModuleDeclaration\n ' NonModuleDeclaration ::=\n ' EnumDeclaration |\n ' StructureDeclaration |\n ' InterfaceDeclaration |\n ' ClassDeclaration |\n ' DelegateDeclaration\n ' ClassMemberDeclaration ::=\n ' NonModuleDeclaration |\n ' EventMemberDeclaration |\n ' VariableMemberDeclaration |\n ' ConstantMemberDeclaration |\n ' MethodMemberDeclaration |\n ' PropertyMemberDeclaration |\n ' ConstructorMemberDeclaration |\n ' OperatorDeclaration\n Select Case node.Kind()\n ' Because fields declarations can define multiple symbols \"Public a, b As Integer\"\n ' We want to get the VariableDeclarator node inside the field declaration to print out the symbol for the name.\n Case SyntaxKind.VariableDeclarator\n If (node.Parent.IsKind(SyntaxKind.FieldDeclaration)) Then\n Return True\n End If\n\n Return False\n\n Case SyntaxKind.NamespaceStatement,\n SyntaxKind.NamespaceBlock,\n SyntaxKind.ModuleStatement,\n SyntaxKind.ModuleBlock,\n SyntaxKind.EnumStatement,\n SyntaxKind.EnumBlock,\n SyntaxKind.StructureStatement,\n SyntaxKind.StructureBlock,\n SyntaxKind.InterfaceStatement,\n SyntaxKind.InterfaceBlock,\n SyntaxKind.ClassStatement,\n SyntaxKind.ClassBlock,\n SyntaxKind.DelegateFunctionStatement,\n SyntaxKind.DelegateSubStatement,\n SyntaxKind.EventStatement,\n SyntaxKind.EventBlock,\n SyntaxKind.AddHandlerAccessorBlock,\n SyntaxKind.RemoveHandlerAccessorBlock,\n SyntaxKind.FieldDeclaration,\n SyntaxKind.SubStatement,\n SyntaxKind.SubBlock,\n SyntaxKind.FunctionStatement,\n SyntaxKind.FunctionBlock,\n SyntaxKind.PropertyStatement,\n SyntaxKind.PropertyBlock,\n SyntaxKind.GetAccessorBlock,\n SyntaxKind.SetAccessorBlock,\n SyntaxKind.SubNewStatement,\n SyntaxKind.ConstructorBlock,\n SyntaxKind.OperatorStatement,\n SyntaxKind.OperatorBlock\n Return True\n End Select\n\n Return False\n End Function\n\n ' TypeDeclaration ::=\n ' ModuleDeclaration |\n ' NonModuleDeclaration\n ' NonModuleDeclaration ::=\n ' EnumDeclaration |\n ' StructureDeclaration |\n ' InterfaceDeclaration |\n ' ClassDeclaration |\n ' DelegateDeclaration\n Public Overrides Function IsTypeDeclaration(node As SyntaxNode) As Boolean\n Select Case node.Kind()\n Case SyntaxKind.EnumBlock,\n SyntaxKind.StructureBlock,\n SyntaxKind.InterfaceBlock,\n SyntaxKind.ClassBlock,\n SyntaxKind.ModuleBlock,\n SyntaxKind.DelegateSubStatement,\n SyntaxKind.DelegateFunctionStatement\n Return True\n End Select\n\n Return False\n End Function\n\n Public Overrides Function IsSimpleAssignmentStatement(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.SimpleAssignmentStatement)\n End Function\n\n Public Overrides Sub GetPartsOfAssignmentStatement(statement As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode)\n ' VB only has assignment statements, so this can just delegate to that helper\n GetPartsOfAssignmentExpressionOrStatement(statement, left, operatorToken, right)\n End Sub\n\n Public Overrides Sub GetPartsOfAssignmentExpressionOrStatement(statement As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode)\n Dim assignment = DirectCast(statement, AssignmentStatementSyntax)\n left = assignment.Left\n operatorToken = assignment.OperatorToken\n right = assignment.Right\n End Sub\n\n Public Overrides Function GetIdentifierOfSimpleName(node As SyntaxNode) As SyntaxToken\n Return DirectCast(node, SimpleNameSyntax).Identifier\n End Function\n\n Public Overrides Function GetIdentifierOfVariableDeclarator(node As SyntaxNode) As SyntaxToken\n Return DirectCast(node, VariableDeclaratorSyntax).Names.Last().Identifier\n End Function\n\n Public Overrides Function GetIdentifierOfParameter(node As SyntaxNode) As SyntaxToken\n Return DirectCast(node, ParameterSyntax).Identifier.Identifier\n End Function\n\n Public Overrides Function GetIdentifierOfTypeDeclaration(node As SyntaxNode) As SyntaxToken\n Select Case node.Kind()\n Case SyntaxKind.EnumStatement,\n SyntaxKind.StructureStatement,\n SyntaxKind.InterfaceStatement,\n SyntaxKind.ClassStatement,\n SyntaxKind.ModuleStatement\n Return DirectCast(node, TypeStatementSyntax).Identifier\n\n Case SyntaxKind.DelegateSubStatement,\n SyntaxKind.DelegateFunctionStatement\n Return DirectCast(node, DelegateStatementSyntax).Identifier\n End Select\n\n Throw ExceptionUtilities.UnexpectedValue(node)\n End Function\n\n Public Overrides Function GetIdentifierOfIdentifierName(node As SyntaxNode) As SyntaxToken\n Return DirectCast(node, IdentifierNameSyntax).Identifier\n End Function\n\n Public Overrides Function IsDeclaratorOfLocalDeclarationStatement(declarator As SyntaxNode, localDeclarationStatement As SyntaxNode) As Boolean\n Return DirectCast(localDeclarationStatement, LocalDeclarationStatementSyntax).Declarators.\n Contains(DirectCast(declarator, VariableDeclaratorSyntax))\n End Function\n\n Public Overrides Function AreEquivalent(token1 As SyntaxToken, token2 As SyntaxToken) As Boolean\n Return SyntaxFactory.AreEquivalent(token1, token2)\n End Function\n\n Public Overrides Function AreEquivalent(node1 As SyntaxNode, node2 As SyntaxNode) As Boolean\n Return SyntaxFactory.AreEquivalent(node1, node2)\n End Function\n\n Public Overrides Function IsExpressionOfForeach(node As SyntaxNode) As Boolean\n Return node IsNot Nothing AndAlso TryCast(node.Parent, ForEachStatementSyntax)?.Expression Is node\n End Function\n\n Public Overrides Function GetExpressionOfExpressionStatement(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, ExpressionStatementSyntax).Expression\n End Function\n\n Public Overrides Function IsIsExpression(node As SyntaxNode) As Boolean\n Return node.IsKind(SyntaxKind.TypeOfIsExpression)\n End Function\n\n Public Overrides Function WalkDownParentheses(node As SyntaxNode) As SyntaxNode\n Return If(TryCast(node, ExpressionSyntax)?.WalkDownParentheses(), node)\n End Function\n\n Public Overrides Sub GetPartsOfTupleExpression(Of TArgumentSyntax As SyntaxNode)(\n node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef arguments As SeparatedSyntaxList(Of TArgumentSyntax), ByRef closeParen As SyntaxToken)\n\n Dim tupleExpr = DirectCast(node, TupleExpressionSyntax)\n openParen = tupleExpr.OpenParenToken\n arguments = CType(CType(tupleExpr.Arguments, SeparatedSyntaxList(Of SyntaxNode)), SeparatedSyntaxList(Of TArgumentSyntax))\n closeParen = tupleExpr.CloseParenToken\n End Sub\n\n Public Overrides Function IsPreprocessorDirective(trivia As SyntaxTrivia) As Boolean\n Return SyntaxFacts.IsPreprocessorDirective(trivia.Kind())\n End Function\n\n Public Overrides Function IsRegularComment(trivia As SyntaxTrivia) As Boolean\n Return trivia.Kind = SyntaxKind.CommentTrivia\n End Function\n\n Public Overrides Function IsDocumentationComment(trivia As SyntaxTrivia) As Boolean\n Return trivia.Kind = SyntaxKind.DocumentationCommentTrivia\n End Function\n\n Public Overrides Function IsElastic(trivia As SyntaxTrivia) As Boolean\n Return trivia.IsElastic()\n End Function\n\n Public Overrides Function IsPragmaDirective(trivia As SyntaxTrivia, ByRef isDisable As Boolean, ByRef isActive As Boolean, ByRef errorCodes As SeparatedSyntaxList(Of SyntaxNode)) As Boolean\n Return trivia.IsPragmaDirective(isDisable, isActive, errorCodes)\n End Function\n\n Public Overrides Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean\n Return token.ContainsInterleavedDirective(span, cancellationToken)\n End Function\n\n Public Overrides Function IsDocumentationCommentExteriorTrivia(trivia As SyntaxTrivia) As Boolean\n Return trivia.Kind() = SyntaxKind.DocumentationCommentExteriorTrivia\n End Function\n\n Public Overrides Function GetModifiers(node As SyntaxNode) As SyntaxTokenList\n Return node.GetModifiers()\n End Function\n\n Public Overrides Function WithModifiers(node As SyntaxNode, modifiers As SyntaxTokenList) As SyntaxNode\n Return node.WithModifiers(modifiers)\n End Function\n\n Public Overrides Function GetVariablesOfLocalDeclarationStatement(node As SyntaxNode) As SeparatedSyntaxList(Of SyntaxNode)\n Return DirectCast(node, LocalDeclarationStatementSyntax).Declarators\n End Function\n\n Public Overrides Function GetInitializerOfVariableDeclarator(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, VariableDeclaratorSyntax).Initializer\n End Function\n\n Public Overrides Function GetTypeOfVariableDeclarator(node As SyntaxNode) As SyntaxNode\n Dim declarator = DirectCast(node, VariableDeclaratorSyntax)\n Return TryCast(declarator.AsClause, SimpleAsClauseSyntax)?.Type\n End Function\n\n Public Overrides Function GetValueOfEqualsValueClause(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, EqualsValueSyntax).Value\n End Function\n\n Public Overrides Function IsScopeBlock(node As SyntaxNode) As Boolean\n ' VB has no equivalent of curly braces.\n Return False\n End Function\n\n Public Overrides Function IsExecutableBlock(node As SyntaxNode) As Boolean\n Return node.IsExecutableBlock()\n End Function\n\n Public Overrides Function GetExecutableBlockStatements(node As SyntaxNode) As IReadOnlyList(Of SyntaxNode)\n Return node.GetExecutableBlockStatements()\n End Function\n\n Public Overrides Function FindInnermostCommonExecutableBlock(nodes As IEnumerable(Of SyntaxNode)) As SyntaxNode\n Return nodes.FindInnermostCommonExecutableBlock()\n End Function\n\n Public Overrides Function IsStatementContainer(node As SyntaxNode) As Boolean\n Return IsExecutableBlock(node)\n End Function\n\n Public Overrides Function GetStatementContainerStatements(node As SyntaxNode) As IReadOnlyList(Of SyntaxNode)\n Return GetExecutableBlockStatements(node)\n End Function\n\n Public Overrides Function IsConversionExpression(node As SyntaxNode) As Boolean\n Return node.Kind = SyntaxKind.CTypeExpression\n End Function\n\n Public Overrides Function IsCastExpression(node As SyntaxNode) As Boolean\n Return node.Kind = SyntaxKind.DirectCastExpression\n End Function\n\n Public Overrides Sub GetPartsOfCastExpression(node As SyntaxNode, ByRef type As SyntaxNode, ByRef expression As SyntaxNode)\n Dim cast = DirectCast(node, DirectCastExpressionSyntax)\n type = cast.Type\n expression = cast.Expression\n End Sub\n\n Public Overrides Function GetDeconstructionReferenceLocation(node As SyntaxNode) As Location\n Throw New NotImplementedException()\n End Function\n\n Public Overrides Function GetDeclarationIdentifierIfOverride(token As SyntaxToken) As SyntaxToken?\n If token.Kind() = SyntaxKind.OverridesKeyword Then\n Dim parent = token.Parent\n\n Select Case parent.Kind()\n Case SyntaxKind.SubStatement, SyntaxKind.FunctionStatement\n Dim method = DirectCast(parent, MethodStatementSyntax)\n Return method.Identifier\n\n Case SyntaxKind.PropertyStatement\n Dim [property] = DirectCast(parent, PropertyStatementSyntax)\n Return [property].Identifier\n End Select\n End If\n\n Return Nothing\n End Function\n\n Public Overrides Function IsPostfixUnaryExpression(node As SyntaxNode) As Boolean\n ' Does not exist in VB.\n Return False\n End Function\n\n Public Overrides Function IsMemberBindingExpression(node As SyntaxNode) As Boolean\n ' Does not exist in VB. VB represents a member binding as a MemberAccessExpression with null target.\n Return False\n End Function\n\n Public Overrides Function IsNameOfMemberBindingExpression(node As SyntaxNode) As Boolean\n ' Does not exist in VB. VB represents a member binding as a MemberAccessExpression with null target.\n Return False\n End Function\n\n Public Overrides Function GetAttributeLists(node As SyntaxNode) As SyntaxList(Of SyntaxNode)\n Return node.GetAttributeLists()\n End Function\n\n Public Overrides Function IsUsingAliasDirective(node As SyntaxNode) As Boolean\n Dim importStatement = TryCast(node, ImportsStatementSyntax)\n\n If (importStatement IsNot Nothing) Then\n For Each importsClause In importStatement.ImportsClauses\n\n If importsClause.Kind = SyntaxKind.SimpleImportsClause Then\n Dim simpleImportsClause = DirectCast(importsClause, SimpleImportsClauseSyntax)\n\n If simpleImportsClause.Alias IsNot Nothing Then\n Return True\n End If\n End If\n Next\n End If\n\n Return False\n End Function\n\n Public Overrides Sub GetPartsOfUsingAliasDirective(\n node As SyntaxNode,\n ByRef globalKeyword As SyntaxToken,\n ByRef [alias] As SyntaxToken,\n ByRef name As SyntaxNode)\n Dim importStatement = DirectCast(node, ImportsStatementSyntax)\n For Each importsClause In importStatement.ImportsClauses\n\n If importsClause.Kind = SyntaxKind.SimpleImportsClause Then\n Dim simpleImportsClause = DirectCast(importsClause, SimpleImportsClauseSyntax)\n\n If simpleImportsClause.Alias IsNot Nothing Then\n globalKeyword = Nothing\n [alias] = simpleImportsClause.Alias.Identifier\n name = simpleImportsClause.Name\n Return\n End If\n End If\n Next\n\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Function IsParameterNameXmlElementSyntax(node As SyntaxNode) As Boolean\n Dim xmlElement = TryCast(node, XmlElementSyntax)\n If xmlElement IsNot Nothing Then\n Dim name = TryCast(xmlElement.StartTag.Name, XmlNameSyntax)\n Return name?.LocalName.ValueText = DocumentationCommentXmlNames.ParameterElementName\n End If\n\n Return False\n End Function\n\n Public Overrides Function GetContentFromDocumentationCommentTriviaSyntax(trivia As SyntaxTrivia) As SyntaxList(Of SyntaxNode)\n Dim documentationCommentTrivia = TryCast(trivia.GetStructure(), DocumentationCommentTriviaSyntax)\n If documentationCommentTrivia IsNot Nothing Then\n Return documentationCommentTrivia.Content\n End If\n\n Return Nothing\n End Function\n\n Friend Shared Function IsChildOf(node As SyntaxNode, kind As SyntaxKind) As Boolean\n Return node.Parent IsNot Nothing AndAlso node.Parent.IsKind(kind)\n End Function\n\n Friend Shared Function IsChildOfVariableDeclaration(node As SyntaxNode) As Boolean\n Return IsChildOf(node, SyntaxKind.FieldDeclaration) OrElse IsChildOf(node, SyntaxKind.LocalDeclarationStatement)\n End Function\n\n Private Shared Function GetDeclarationCount(nodes As IReadOnlyList(Of SyntaxNode)) As Integer\n Dim count As Integer = 0\n For i = 0 To nodes.Count - 1\n count = count + GetDeclarationCount(nodes(i))\n Next\n\n Return count\n End Function\n\n Friend Shared Function GetDeclarationCount(node As SyntaxNode) As Integer\n Select Case node.Kind\n Case SyntaxKind.FieldDeclaration\n Return GetDeclarationCount(DirectCast(node, FieldDeclarationSyntax).Declarators)\n Case SyntaxKind.LocalDeclarationStatement\n Return GetDeclarationCount(DirectCast(node, LocalDeclarationStatementSyntax).Declarators)\n Case SyntaxKind.VariableDeclarator\n Return DirectCast(node, VariableDeclaratorSyntax).Names.Count\n Case SyntaxKind.AttributesStatement\n Return GetDeclarationCount(DirectCast(node, AttributesStatementSyntax).AttributeLists)\n Case SyntaxKind.AttributeList\n Return DirectCast(node, AttributeListSyntax).Attributes.Count\n Case SyntaxKind.ImportsStatement\n Return DirectCast(node, ImportsStatementSyntax).ImportsClauses.Count\n End Select\n\n Return 1\n End Function\n\n Public Overrides Function SupportsNotPattern(options As ParseOptions) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsIsPatternExpression(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsAnyPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsAndPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsBinaryPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsConstantPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsDeclarationPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsNotPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsOrPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsParenthesizedPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsRecursivePattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsUnaryPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsTypePattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Function IsVarPattern(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n Public Overrides Sub GetPartsOfIsPatternExpression(node As SyntaxNode, ByRef left As SyntaxNode, ByRef isToken As SyntaxToken, ByRef right As SyntaxNode)\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Function GetExpressionOfConstantPattern(node As SyntaxNode) As SyntaxNode\n Throw ExceptionUtilities.Unreachable\n End Function\n\n Public Overrides Sub GetPartsOfParenthesizedPattern(node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef pattern As SyntaxNode, ByRef closeParen As SyntaxToken)\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Sub GetPartsOfBinaryPattern(node As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode)\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Sub GetPartsOfUnaryPattern(node As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef pattern As SyntaxNode)\n Throw ExceptionUtilities.Unreachable\n End Sub\n\n Public Overrides Sub GetPartsOfDeclarationPattern(node As SyntaxNode, ByRef type As SyntaxNode, ByRef designation As SyntaxNode)\n Throw New NotImplementedException()\n End Sub\n\n Public Overrides Sub GetPartsOfRecursivePattern(node As SyntaxNode, ByRef type As SyntaxNode, ByRef positionalPart As SyntaxNode, ByRef propertyPart As SyntaxNode, ByRef designation As SyntaxNode)\n Throw New NotImplementedException()\n End Sub\n\n Public Overrides Function GetTypeOfTypePattern(node As SyntaxNode) As SyntaxNode\n Throw New NotImplementedException()\n End Function\n\n Public Overrides Sub GetPartsOfInterpolationExpression(node As SyntaxNode, ByRef stringStartToken As SyntaxToken, ByRef contents As SyntaxList(Of SyntaxNode), ByRef stringEndToken As SyntaxToken)\n Dim interpolatedStringExpressionSyntax As InterpolatedStringExpressionSyntax = DirectCast(node, InterpolatedStringExpressionSyntax)\n stringStartToken = interpolatedStringExpressionSyntax.DollarSignDoubleQuoteToken\n contents = interpolatedStringExpressionSyntax.Contents\n stringEndToken = interpolatedStringExpressionSyntax.DoubleQuoteToken\n End Sub\n\n Public Overrides Function IsVerbatimInterpolatedStringExpression(node As SyntaxNode) As Boolean\n Return False\n End Function\n\n#Region \"IsXXX members\"\n\n Public Overrides Function IsAnonymousFunctionExpression(node As SyntaxNode) As Boolean\n Return TypeOf node Is LambdaExpressionSyntax\n End Function\n\n Public Overrides Function IsBaseNamespaceDeclaration( node As SyntaxNode) As Boolean\n Return TypeOf node Is NamespaceBlockSyntax\n End Function\n\n Public Overrides Function IsBinaryExpression(node As SyntaxNode) As Boolean\n Return TypeOf node Is BinaryExpressionSyntax\n End Function\n\n Public Overrides Function IsLiteralExpression(node As SyntaxNode) As Boolean\n Return TypeOf node Is LiteralExpressionSyntax\n End Function\n\n Public Overrides Function IsMemberAccessExpression(node As SyntaxNode) As Boolean\n Return TypeOf node Is MemberAccessExpressionSyntax\n End Function\n\n Public Overrides Function IsSimpleName(node As SyntaxNode) As Boolean\n Return TypeOf node Is SimpleNameSyntax\n End Function\n\n#End Region\n\n#Region \"GetPartsOfXXX members\"\n\n Public Overrides Sub GetPartsOfBinaryExpression(node As SyntaxNode, ByRef left As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef right As SyntaxNode)\n Dim binaryExpression = DirectCast(node, BinaryExpressionSyntax)\n left = binaryExpression.Left\n operatorToken = binaryExpression.OperatorToken\n right = binaryExpression.Right\n End Sub\n\n Public Overrides Sub GetPartsOfCompilationUnit(node As SyntaxNode, ByRef [imports] As SyntaxList(Of SyntaxNode), ByRef attributeLists As SyntaxList(Of SyntaxNode), ByRef members As SyntaxList(Of SyntaxNode))\n Dim compilationUnit = DirectCast(node, CompilationUnitSyntax)\n [imports] = compilationUnit.Imports\n attributeLists = compilationUnit.Attributes\n members = compilationUnit.Members\n End Sub\n\n Public Overrides Sub GetPartsOfConditionalAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef whenNotNull As SyntaxNode)\n Dim conditionalAccess = DirectCast(node, ConditionalAccessExpressionSyntax)\n expression = conditionalAccess.Expression\n operatorToken = conditionalAccess.QuestionMarkToken\n whenNotNull = conditionalAccess.WhenNotNull\n End Sub\n\n Public Overrides Sub GetPartsOfConditionalExpression(node As SyntaxNode, ByRef condition As SyntaxNode, ByRef whenTrue As SyntaxNode, ByRef whenFalse As SyntaxNode)\n Dim conditionalExpression = DirectCast(node, TernaryConditionalExpressionSyntax)\n condition = conditionalExpression.Condition\n whenTrue = conditionalExpression.WhenTrue\n whenFalse = conditionalExpression.WhenFalse\n End Sub\n\n Public Overrides Sub GetPartsOfInvocationExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef argumentList As SyntaxNode)\n Dim invocation = DirectCast(node, InvocationExpressionSyntax)\n expression = invocation.Expression\n argumentList = invocation.ArgumentList\n End Sub\n\n Public Overrides Sub GetPartsOfMemberAccessExpression(node As SyntaxNode, ByRef expression As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef name As SyntaxNode)\n Dim memberAccess = DirectCast(node, MemberAccessExpressionSyntax)\n expression = memberAccess.Expression\n operatorToken = memberAccess.OperatorToken\n name = memberAccess.Name\n End Sub\n\n Public Overrides Sub GetPartsOfBaseNamespaceDeclaration(node As SyntaxNode, ByRef name As SyntaxNode, ByRef [imports] As SyntaxList(Of SyntaxNode), ByRef members As SyntaxList(Of SyntaxNode))\n Dim namespaceBlock = DirectCast(node, NamespaceBlockSyntax)\n name = namespaceBlock.NamespaceStatement.Name\n [imports] = Nothing\n members = namespaceBlock.Members\n End Sub\n\n Public Overrides Sub GetPartsOfObjectCreationExpression(node As SyntaxNode, ByRef type As SyntaxNode, ByRef argumentList As SyntaxNode, ByRef initializer As SyntaxNode)\n Dim objectCreationExpression = DirectCast(node, ObjectCreationExpressionSyntax)\n type = objectCreationExpression.Type\n argumentList = objectCreationExpression.ArgumentList\n initializer = objectCreationExpression.Initializer\n End Sub\n\n Public Overrides Sub GetPartsOfParenthesizedExpression(node As SyntaxNode, ByRef openParen As SyntaxToken, ByRef expression As SyntaxNode, ByRef closeParen As SyntaxToken)\n Dim parenthesizedExpression = DirectCast(node, ParenthesizedExpressionSyntax)\n openParen = parenthesizedExpression.OpenParenToken\n expression = parenthesizedExpression.Expression\n closeParen = parenthesizedExpression.CloseParenToken\n End Sub\n\n Public Overrides Sub GetPartsOfPrefixUnaryExpression(node As SyntaxNode, ByRef operatorToken As SyntaxToken, ByRef operand As SyntaxNode)\n Dim unaryExpression = DirectCast(node, UnaryExpressionSyntax)\n operatorToken = unaryExpression.OperatorToken\n operand = unaryExpression.Operand\n End Sub\n\n Public Overrides Sub GetPartsOfQualifiedName(node As SyntaxNode, ByRef left As SyntaxNode, ByRef dotToken As SyntaxToken, ByRef right As SyntaxNode)\n Dim qualifiedName = DirectCast(node, QualifiedNameSyntax)\n left = qualifiedName.Left\n dotToken = qualifiedName.DotToken\n right = qualifiedName.Right\n End Sub\n\n#End Region\n\n#Region \"GetXXXOfYYY members\"\n\n Public Overrides Function GetExpressionOfAwaitExpression(node As SyntaxNode) As SyntaxNode\n Return DirectCast(node, AwaitExpressionSyntax).Expression\n End Function\n\n Public Overrides Function GetExpressionOfThrowExpression(node As SyntaxNode) As SyntaxNode\n ' ThrowExpression doesn't exist in VB\n Throw New NotImplementedException()\n End Function\n\n#End Region\n End Class\nEnd Namespace\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":212,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/IndentBlockOperation.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Formatting.Rules\n{\n /// \n /// set indentation level for the given text span. it can be relative, absolute or dependent to other tokens\n /// \n internal sealed class IndentBlockOperation\n {\n internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)\n {\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));\n\n Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);\n Contract.ThrowIfTrue(startToken.RawKind == 0);\n Contract.ThrowIfTrue(endToken.RawKind == 0);\n\n this.BaseToken = default;\n this.TextSpan = textSpan;\n\n this.Option = option;\n this.StartToken = startToken;\n this.EndToken = endToken;\n\n this.IsRelativeIndentation = false;\n this.IndentationDeltaOrPosition = indentationDelta;\n }\n\n internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)\n {\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));\n\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask));\n Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);\n\n Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);\n Contract.ThrowIfTrue(startToken.RawKind == 0);\n Contract.ThrowIfTrue(endToken.RawKind == 0);\n\n this.BaseToken = baseToken;\n this.TextSpan = textSpan;\n\n this.Option = option;\n this.StartToken = startToken;\n this.EndToken = endToken;\n\n this.IsRelativeIndentation = true;\n this.IndentationDeltaOrPosition = indentationDelta;\n }\n\n public SyntaxToken BaseToken { get; }\n public TextSpan TextSpan { get; }\n\n public IndentBlockOption Option { get; }\n\n public SyntaxToken StartToken { get; }\n public SyntaxToken EndToken { get; }\n\n public bool IsRelativeIndentation { get; }\n public int IndentationDeltaOrPosition { get; }\n\n#if DEBUG\n public override string ToString()\n => $\"Indent {TextSpan} from '{StartToken}' to '{EndToken}', by {IndentationDeltaOrPosition}, with base token '{BaseToken}'\";\n#endif\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Formatting.Rules\n{\n /// \n /// set indentation level for the given text span. it can be relative, absolute or dependent to other tokens\n /// \n internal sealed class IndentBlockOperation\n {\n internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)\n {\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));\n\n Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);\n Contract.ThrowIfTrue(startToken.RawKind == 0);\n Contract.ThrowIfTrue(endToken.RawKind == 0);\n\n this.BaseToken = default;\n this.TextSpan = textSpan;\n\n this.Option = option;\n this.StartToken = startToken;\n this.EndToken = endToken;\n\n this.IsRelativeIndentation = false;\n this.IndentationDeltaOrPosition = indentationDelta;\n }\n\n internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)\n {\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));\n\n Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask));\n Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);\n\n Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);\n Contract.ThrowIfTrue(startToken.RawKind == 0);\n Contract.ThrowIfTrue(endToken.RawKind == 0);\n\n this.BaseToken = baseToken;\n this.TextSpan = textSpan;\n\n this.Option = option;\n this.StartToken = startToken;\n this.EndToken = endToken;\n\n this.IsRelativeIndentation = true;\n this.IndentationDeltaOrPosition = indentationDelta;\n }\n\n public SyntaxToken BaseToken { get; }\n public TextSpan TextSpan { get; }\n\n public IndentBlockOption Option { get; }\n\n public SyntaxToken StartToken { get; }\n public SyntaxToken EndToken { get; }\n\n public bool IsRelativeIndentation { get; }\n public int IndentationDeltaOrPosition { get; }\n\n#if DEBUG\n public override string ToString()\n => $\"Indent {TextSpan} from '{StartToken}' to '{EndToken}', by {IndentationDeltaOrPosition}, with base token '{BaseToken}'\";\n#endif\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":213,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Features/Core/Portable/EmbeddedLanguages/DateAndTime/DateAndTimeEmbeddedLanguageFeatures.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.Completion;\nusing Microsoft.CodeAnalysis.DocumentHighlighting;\nusing Microsoft.CodeAnalysis.EmbeddedLanguages.DateAndTime.LanguageServices;\nusing Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices;\n\nnamespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.DateAndTime\n{\n internal class DateAndTimeEmbeddedLanguageFeatures : DateAndTimeEmbeddedLanguage, IEmbeddedLanguageFeatures\n {\n // No highlights currently for date/time literals.\n public IDocumentHighlightsService? DocumentHighlightsService { get; }\n public CompletionProvider CompletionProvider { get; }\n\n public DateAndTimeEmbeddedLanguageFeatures(\n EmbeddedLanguageInfo info) : base(info)\n {\n CompletionProvider = new DateAndTimeEmbeddedCompletionProvider(this);\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.Completion;\nusing Microsoft.CodeAnalysis.DocumentHighlighting;\nusing Microsoft.CodeAnalysis.EmbeddedLanguages.DateAndTime.LanguageServices;\nusing Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices;\n\nnamespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.DateAndTime\n{\n internal class DateAndTimeEmbeddedLanguageFeatures : DateAndTimeEmbeddedLanguage, IEmbeddedLanguageFeatures\n {\n // No highlights currently for date/time literals.\n public IDocumentHighlightsService? DocumentHighlightsService { get; }\n public CompletionProvider CompletionProvider { get; }\n\n public DateAndTimeEmbeddedLanguageFeatures(\n EmbeddedLanguageInfo info) : base(info)\n {\n CompletionProvider = new DateAndTimeEmbeddedCompletionProvider(this);\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":214,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpMiscellaneousReducer.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.CSharp.Utilities;\nusing Microsoft.CodeAnalysis.Options;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Simplification;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Simplification\n{\n internal partial class CSharpMiscellaneousReducer : AbstractCSharpReducer\n {\n private static readonly ObjectPool s_pool = new(\n () => new Rewriter(s_pool));\n\n public CSharpMiscellaneousReducer() : base(s_pool)\n {\n }\n\n private static bool CanRemoveTypeFromParameter(\n ParameterSyntax parameterSyntax,\n SemanticModel semanticModel,\n CancellationToken cancellationToken)\n {\n // We reduce any the parameters that are contained inside ParameterList\n if (parameterSyntax.IsParentKind(SyntaxKind.ParameterList) &&\n parameterSyntax.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression))\n {\n if (parameterSyntax.Type != null)\n {\n var annotation = new SyntaxAnnotation();\n var newParameterSyntax = parameterSyntax.WithType(null).WithAdditionalAnnotations(annotation);\n\n var oldLambda = parameterSyntax.FirstAncestorOrSelf();\n var newLambda = oldLambda.ReplaceNode(parameterSyntax, newParameterSyntax);\n var speculationAnalyzer = new SpeculationAnalyzer(oldLambda, newLambda, semanticModel, cancellationToken);\n newParameterSyntax = (ParameterSyntax)speculationAnalyzer.ReplacedExpression.GetAnnotatedNodesAndTokens(annotation).First();\n\n var oldSymbol = semanticModel.GetDeclaredSymbol(parameterSyntax, cancellationToken);\n var newSymbol = speculationAnalyzer.SpeculativeSemanticModel.GetDeclaredSymbol(newParameterSyntax, cancellationToken);\n if (oldSymbol != null &&\n newSymbol != null &&\n Equals(oldSymbol.Type, newSymbol.Type))\n {\n return !speculationAnalyzer.ReplacementChangesSemantics();\n }\n }\n }\n\n return false;\n }\n\n private static readonly Func s_simplifyParameter = SimplifyParameter;\n\n private static SyntaxNode SimplifyParameter(\n ParameterSyntax node,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (CanRemoveTypeFromParameter(node, semanticModel, cancellationToken))\n {\n var newParameterSyntax = node.WithType(null);\n newParameterSyntax = SimplificationHelpers.CopyAnnotations(node, newParameterSyntax).WithoutAnnotations(Simplifier.Annotation);\n return newParameterSyntax;\n }\n\n return node;\n }\n\n private static readonly Func s_simplifyParenthesizedLambdaExpression = SimplifyParenthesizedLambdaExpression;\n\n private static SyntaxNode SimplifyParenthesizedLambdaExpression(\n ParenthesizedLambdaExpressionSyntax parenthesizedLambda,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (parenthesizedLambda.ParameterList != null &&\n parenthesizedLambda.ParameterList.Parameters.Count == 1)\n {\n var parameter = parenthesizedLambda.ParameterList.Parameters.First();\n if (CanRemoveTypeFromParameter(parameter, semanticModel, cancellationToken))\n {\n var newParameterSyntax = parameter.WithType(null);\n var newSimpleLambda = SyntaxFactory.SimpleLambdaExpression(\n parenthesizedLambda.AsyncKeyword,\n newParameterSyntax.WithTrailingTrivia(parenthesizedLambda.ParameterList.GetTrailingTrivia()),\n parenthesizedLambda.ArrowToken,\n parenthesizedLambda.Body);\n\n return SimplificationHelpers.CopyAnnotations(parenthesizedLambda, newSimpleLambda).WithoutAnnotations(Simplifier.Annotation);\n }\n }\n\n return parenthesizedLambda;\n }\n\n private static readonly Func s_simplifyBlock = SimplifyBlock;\n\n private static SyntaxNode SimplifyBlock(\n BlockSyntax node,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (node.Statements.Count != 1)\n {\n return node;\n }\n\n if (!CanHaveEmbeddedStatement(node.Parent))\n {\n return node;\n }\n\n switch (optionSet.GetOption(CSharpCodeStyleOptions.PreferBraces).Value)\n {\n case PreferBracesPreference.Always:\n default:\n return node;\n\n case PreferBracesPreference.WhenMultiline:\n // Braces are optional in several scenarios for 'when_multiline', but are only automatically removed\n // in a subset of cases where all of the following are met:\n //\n // 1. This is an 'if' statement\n // 1. The 'if' statement does not have an 'else' clause and is not part of a larger 'if'/'else if'/'else' sequence\n // 2. The 'if' statement is not considered multiline\n if (!node.Parent.IsKind(SyntaxKind.IfStatement))\n {\n // Braces are only removed for 'if' statements\n return node;\n }\n\n if (node.Parent.IsParentKind(SyntaxKind.IfStatement, SyntaxKind.ElseClause))\n {\n // Braces are not removed from more complicated 'if' sequences\n return node;\n }\n\n if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Statements[0].GetFirstToken(), node.Statements[0].GetLastToken()))\n {\n // Braces are not removed when the embedded statement is multiline\n return node;\n }\n\n if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Parent.GetFirstToken(), node.GetFirstToken().GetPreviousToken()))\n {\n // Braces are not removed when the part of the 'if' statement preceding the embedded statement\n // is multiline.\n return node;\n }\n\n break;\n\n case PreferBracesPreference.None:\n break;\n }\n\n return node.Statements[0];\n }\n\n private static bool CanHaveEmbeddedStatement(SyntaxNode node)\n {\n if (node != null)\n {\n switch (node.Kind())\n {\n case SyntaxKind.IfStatement:\n case SyntaxKind.ElseClause:\n case SyntaxKind.ForStatement:\n case SyntaxKind.ForEachStatement:\n case SyntaxKind.ForEachVariableStatement:\n case SyntaxKind.WhileStatement:\n case SyntaxKind.DoStatement:\n case SyntaxKind.UsingStatement:\n case SyntaxKind.LockStatement:\n return true;\n }\n }\n\n return false;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.CSharp.Utilities;\nusing Microsoft.CodeAnalysis.Options;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Simplification;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Simplification\n{\n internal partial class CSharpMiscellaneousReducer : AbstractCSharpReducer\n {\n private static readonly ObjectPool s_pool = new(\n () => new Rewriter(s_pool));\n\n public CSharpMiscellaneousReducer() : base(s_pool)\n {\n }\n\n private static bool CanRemoveTypeFromParameter(\n ParameterSyntax parameterSyntax,\n SemanticModel semanticModel,\n CancellationToken cancellationToken)\n {\n // We reduce any the parameters that are contained inside ParameterList\n if (parameterSyntax.IsParentKind(SyntaxKind.ParameterList) &&\n parameterSyntax.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression))\n {\n if (parameterSyntax.Type != null)\n {\n var annotation = new SyntaxAnnotation();\n var newParameterSyntax = parameterSyntax.WithType(null).WithAdditionalAnnotations(annotation);\n\n var oldLambda = parameterSyntax.FirstAncestorOrSelf();\n var newLambda = oldLambda.ReplaceNode(parameterSyntax, newParameterSyntax);\n var speculationAnalyzer = new SpeculationAnalyzer(oldLambda, newLambda, semanticModel, cancellationToken);\n newParameterSyntax = (ParameterSyntax)speculationAnalyzer.ReplacedExpression.GetAnnotatedNodesAndTokens(annotation).First();\n\n var oldSymbol = semanticModel.GetDeclaredSymbol(parameterSyntax, cancellationToken);\n var newSymbol = speculationAnalyzer.SpeculativeSemanticModel.GetDeclaredSymbol(newParameterSyntax, cancellationToken);\n if (oldSymbol != null &&\n newSymbol != null &&\n Equals(oldSymbol.Type, newSymbol.Type))\n {\n return !speculationAnalyzer.ReplacementChangesSemantics();\n }\n }\n }\n\n return false;\n }\n\n private static readonly Func s_simplifyParameter = SimplifyParameter;\n\n private static SyntaxNode SimplifyParameter(\n ParameterSyntax node,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (CanRemoveTypeFromParameter(node, semanticModel, cancellationToken))\n {\n var newParameterSyntax = node.WithType(null);\n newParameterSyntax = SimplificationHelpers.CopyAnnotations(node, newParameterSyntax).WithoutAnnotations(Simplifier.Annotation);\n return newParameterSyntax;\n }\n\n return node;\n }\n\n private static readonly Func s_simplifyParenthesizedLambdaExpression = SimplifyParenthesizedLambdaExpression;\n\n private static SyntaxNode SimplifyParenthesizedLambdaExpression(\n ParenthesizedLambdaExpressionSyntax parenthesizedLambda,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (parenthesizedLambda.ParameterList != null &&\n parenthesizedLambda.ParameterList.Parameters.Count == 1)\n {\n var parameter = parenthesizedLambda.ParameterList.Parameters.First();\n if (CanRemoveTypeFromParameter(parameter, semanticModel, cancellationToken))\n {\n var newParameterSyntax = parameter.WithType(null);\n var newSimpleLambda = SyntaxFactory.SimpleLambdaExpression(\n parenthesizedLambda.AsyncKeyword,\n newParameterSyntax.WithTrailingTrivia(parenthesizedLambda.ParameterList.GetTrailingTrivia()),\n parenthesizedLambda.ArrowToken,\n parenthesizedLambda.Body);\n\n return SimplificationHelpers.CopyAnnotations(parenthesizedLambda, newSimpleLambda).WithoutAnnotations(Simplifier.Annotation);\n }\n }\n\n return parenthesizedLambda;\n }\n\n private static readonly Func s_simplifyBlock = SimplifyBlock;\n\n private static SyntaxNode SimplifyBlock(\n BlockSyntax node,\n SemanticModel semanticModel,\n OptionSet optionSet,\n CancellationToken cancellationToken)\n {\n if (node.Statements.Count != 1)\n {\n return node;\n }\n\n if (!CanHaveEmbeddedStatement(node.Parent))\n {\n return node;\n }\n\n switch (optionSet.GetOption(CSharpCodeStyleOptions.PreferBraces).Value)\n {\n case PreferBracesPreference.Always:\n default:\n return node;\n\n case PreferBracesPreference.WhenMultiline:\n // Braces are optional in several scenarios for 'when_multiline', but are only automatically removed\n // in a subset of cases where all of the following are met:\n //\n // 1. This is an 'if' statement\n // 1. The 'if' statement does not have an 'else' clause and is not part of a larger 'if'/'else if'/'else' sequence\n // 2. The 'if' statement is not considered multiline\n if (!node.Parent.IsKind(SyntaxKind.IfStatement))\n {\n // Braces are only removed for 'if' statements\n return node;\n }\n\n if (node.Parent.IsParentKind(SyntaxKind.IfStatement, SyntaxKind.ElseClause))\n {\n // Braces are not removed from more complicated 'if' sequences\n return node;\n }\n\n if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Statements[0].GetFirstToken(), node.Statements[0].GetLastToken()))\n {\n // Braces are not removed when the embedded statement is multiline\n return node;\n }\n\n if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Parent.GetFirstToken(), node.GetFirstToken().GetPreviousToken()))\n {\n // Braces are not removed when the part of the 'if' statement preceding the embedded statement\n // is multiline.\n return node;\n }\n\n break;\n\n case PreferBracesPreference.None:\n break;\n }\n\n return node.Statements[0];\n }\n\n private static bool CanHaveEmbeddedStatement(SyntaxNode node)\n {\n if (node != null)\n {\n switch (node.Kind())\n {\n case SyntaxKind.IfStatement:\n case SyntaxKind.ElseClause:\n case SyntaxKind.ForStatement:\n case SyntaxKind.ForEachStatement:\n case SyntaxKind.ForEachVariableStatement:\n case SyntaxKind.WhileStatement:\n case SyntaxKind.DoStatement:\n case SyntaxKind.UsingStatement:\n case SyntaxKind.LockStatement:\n return true;\n }\n }\n\n return false;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":215,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Workspaces/Core/Portable/Workspace/Host/EventListener/ExportEventListenerAttribute.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Composition;\n\nnamespace Microsoft.CodeAnalysis.Host\n{\n [MetadataAttribute]\n [AttributeUsage(AttributeTargets.Class)]\n internal class ExportEventListenerAttribute : ExportAttribute\n {\n public string Service { get; }\n public IReadOnlyCollection WorkspaceKinds { get; }\n\n /// \n /// MEF export attribute for \n /// \n /// \n /// one of values from indicating which service this event listener is for\n /// \n /// indicate which workspace kind this event listener is for\n public ExportEventListenerAttribute(string service, params string[] workspaceKinds)\n : base(typeof(IEventListener))\n {\n if (workspaceKinds?.Length == 0)\n {\n throw new ArgumentException(nameof(workspaceKinds));\n }\n\n this.Service = service ?? throw new ArgumentException(nameof(service));\n this.WorkspaceKinds = workspaceKinds;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Composition;\n\nnamespace Microsoft.CodeAnalysis.Host\n{\n [MetadataAttribute]\n [AttributeUsage(AttributeTargets.Class)]\n internal class ExportEventListenerAttribute : ExportAttribute\n {\n public string Service { get; }\n public IReadOnlyCollection WorkspaceKinds { get; }\n\n /// \n /// MEF export attribute for \n /// \n /// \n /// one of values from indicating which service this event listener is for\n /// \n /// indicate which workspace kind this event listener is for\n public ExportEventListenerAttribute(string service, params string[] workspaceKinds)\n : base(typeof(IEventListener))\n {\n if (workspaceKinds?.Length == 0)\n {\n throw new ArgumentException(nameof(workspaceKinds));\n }\n\n this.Service = service ?? throw new ArgumentException(nameof(service));\n this.WorkspaceKinds = workspaceKinds;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":216,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56488,"string":"56,488"},"pr_title":{"kind":"string","value":"Make abstract type actually implement interface."},"pr_description":{"kind":"string","value":"Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"author":{"kind":"string","value":"CyrusNajmabadi"},"date_created":{"kind":"timestamp","value":"2021-09-17T18:55:33Z","string":"2021-09-17T18:55:33Z"},"date_merged":{"kind":"timestamp","value":"2021-09-18T00:30:26Z","string":"2021-09-18T00:30:26Z"},"previous_commit":{"kind":"string","value":"69e33ded29a49279b3da616fb73a3e4e445f3546"},"pr_commit":{"kind":"string","value":"fb5150d1c427f20030d315b9b42ce084dd8eb486"},"query":{"kind":"string","value":"Make abstract type actually implement interface.. Not sure why this abstract class wasn't implenting the interface it claimed to. This made life difficult as it meant that hte abstract type couldn't refer to extensions on the interface it was supposed to be implementing."},"filepath":{"kind":"string","value":"./src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Roslyn.Test.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.UnitTests.Collections\n{\n public class ImmutableArrayExtensionsTests\n {\n [Fact]\n public void CreateFrom()\n {\n ImmutableArray a;\n\n a = ImmutableArray.Create(2);\n Assert.Equal(1, a.Length);\n Assert.Equal(2, a[0]);\n\n Assert.Throws(() => ImmutableArray.CreateRange((IEnumerable)null));\n\n a = ImmutableArray.CreateRange(Enumerable.Range(1, 2));\n Assert.Equal(2, a.Length);\n Assert.Equal(1, a[0]);\n Assert.Equal(2, a[1]);\n }\n\n [Fact]\n public void ReadOnlyArraysBroken()\n {\n var b = new ArrayBuilder();\n b.Add(\"hello\");\n b.Add(\"world\");\n Assert.Equal(\"hello\", b[0]);\n var a = b.AsImmutable();\n Assert.Equal(\"hello\", a[0]);\n var e = (IEnumerable)a;\n Assert.Equal(\"hello\", e.First());\n var aa = e.ToArray();\n Assert.Equal(\"hello\", aa[0]);\n\n var first = b.FirstOrDefault((x) => true);\n Assert.Equal(\"hello\", first);\n\n ImmutableArray nullOrEmpty = default(ImmutableArray);\n Assert.True(nullOrEmpty.IsDefault);\n Assert.True(nullOrEmpty.IsDefaultOrEmpty);\n Assert.Throws(() => nullOrEmpty.IsEmpty);\n\n nullOrEmpty = ImmutableArray.Create();\n Assert.True(nullOrEmpty.IsEmpty);\n }\n\n [Fact]\n public void InsertAt()\n {\n var builder = new ArrayBuilder();\n builder.Insert(0, \"candy\");\n builder.Insert(0, \"apple\");\n builder.Insert(2, \"elephant\");\n builder.Insert(2, \"drum\");\n builder.Insert(1, \"banana\");\n builder.Insert(0, \"$$$\");\n\n Assert.Equal(\"$$$\", builder[0]);\n Assert.Equal(\"apple\", builder[1]);\n Assert.Equal(\"banana\", builder[2]);\n Assert.Equal(\"candy\", builder[3]);\n Assert.Equal(\"drum\", builder[4]);\n Assert.Equal(\"elephant\", builder[5]);\n }\n\n [Fact]\n public void SetEquals()\n {\n var nul = default(ImmutableArray);\n var empty = ImmutableArray.Create();\n\n var original = new int[] { 1, 2, 3, }.AsImmutableOrNull();\n var notEqualSubset = new int[] { 1, 2, }.AsImmutableOrNull();\n var notEqualSuperset = new int[] { 1, 2, 3, 4, }.AsImmutableOrNull();\n var equalOrder = new int[] { 2, 1, 3, }.AsImmutableOrNull();\n var equalElements = new int[] { -1, -2, -3 }.AsImmutableOrNull();\n var equalDuplicate = new int[] { 1, 2, 3, 3, -3 }.AsImmutableOrNull();\n\n IEqualityComparer comparer = new AbsoluteValueComparer();\n\n Assert.True(nul.SetEquals(nul, comparer));\n Assert.True(empty.SetEquals(empty, comparer));\n Assert.True(original.SetEquals(original, comparer));\n\n Assert.True(original.SetEquals(equalOrder, comparer));\n Assert.True(original.SetEquals(equalElements, comparer));\n Assert.True(original.SetEquals(equalDuplicate, comparer));\n\n Assert.False(nul.SetEquals(empty, comparer));\n Assert.False(nul.SetEquals(original, comparer));\n\n Assert.False(empty.SetEquals(nul, comparer));\n Assert.False(empty.SetEquals(original, comparer));\n\n Assert.False(original.SetEquals(nul, comparer));\n Assert.False(original.SetEquals(empty, comparer));\n Assert.False(original.SetEquals(notEqualSubset, comparer));\n Assert.False(original.SetEquals(notEqualSuperset, comparer));\n\n //there's a special case for this in the impl, so cover it specially\n var singleton1 = ImmutableArray.Create(1);\n var singleton2 = ImmutableArray.Create(2);\n\n Assert.True(singleton1.SetEquals(singleton1, comparer));\n Assert.False(singleton1.SetEquals(singleton2, comparer));\n }\n\n private class AbsoluteValueComparer : IEqualityComparer\n {\n #region IEqualityComparer Members\n\n bool IEqualityComparer.Equals(int x, int y)\n {\n return Math.Abs(x) == Math.Abs(y);\n }\n\n int IEqualityComparer.GetHashCode(int x)\n {\n return Math.Abs(x);\n }\n #endregion\n }\n\n [Fact]\n public void Single()\n {\n Assert.Throws(() => default(ImmutableArray).Single());\n Assert.Throws(() => ImmutableArray.Create().Single());\n Assert.Equal(1, ImmutableArray.Create(1).Single());\n Assert.Throws(() => ImmutableArray.Create(1, 2).Single());\n\n Func isOdd = x => x % 2 == 1;\n\n // BUG:753260 Should this be ArgumentNullException for consistency?\n Assert.Throws(() => default(ImmutableArray).Single(isOdd));\n Assert.Throws(() => ImmutableArray.Create().Single(isOdd));\n Assert.Equal(1, ImmutableArray.Create(1, 2).Single(isOdd));\n Assert.Throws(() => ImmutableArray.Create(1, 2, 3).Single(isOdd));\n }\n\n [Fact]\n public void IndexOf()\n {\n var roa = new int[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.Equal(1, roa.IndexOf(2));\n }\n\n [Fact]\n public void CompareToNull()\n {\n var roaNull = default(ImmutableArray);\n Assert.True(roaNull == null);\n Assert.False(roaNull != null);\n Assert.True(null == roaNull);\n Assert.False(null != roaNull);\n\n var copy = roaNull;\n Assert.True(copy == roaNull);\n Assert.False(copy != roaNull);\n\n var notnull = ImmutableArray.Create();\n Assert.False(notnull == null);\n Assert.True(notnull != null);\n Assert.False(null == notnull);\n Assert.True(null != notnull);\n }\n\n [Fact]\n public void CopyTo()\n {\n var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();\n var roaCopy = new int?[4];\n roa.CopyTo(roaCopy, 1);\n Assert.False(roaCopy[0].HasValue);\n Assert.Equal(1, roaCopy[1].Value);\n Assert.False(roaCopy[2].HasValue);\n Assert.Equal(3, roaCopy[3].Value);\n }\n\n [Fact]\n public void ElementAt()\n {\n var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();\n Assert.Equal(1, roa.ElementAt(0).Value);\n Assert.False(roa.ElementAt(1).HasValue);\n Assert.Equal(3, roa.ElementAt(2).Value);\n }\n\n [Fact]\n public void ElementAtOrDefault()\n {\n var roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.False(roa.ElementAtOrDefault(-1).HasValue);\n Assert.Equal(1, roa.ElementAtOrDefault(0).Value);\n Assert.Equal(2, roa.ElementAtOrDefault(1).Value);\n Assert.Equal(3, roa.ElementAtOrDefault(2).Value);\n Assert.False(roa.ElementAtOrDefault(10).HasValue);\n }\n\n [Fact]\n public void Last()\n {\n var roa = new int?[] { }.AsImmutableOrNull();\n Assert.Throws(() => roa.Last());\n roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.Throws(() => roa.Last(i => i < 1));\n Assert.Equal(3, roa.Last(i => i > 1));\n }\n\n [Fact]\n public void LastOrDefault()\n {\n var roa = new int?[] { }.AsImmutableOrNull();\n Assert.False(roa.LastOrDefault().HasValue);\n roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.False(roa.LastOrDefault(i => i < 1).HasValue);\n Assert.Equal(3, roa.LastOrDefault(i => i > 1));\n }\n\n [Fact]\n public void SingleOrDefault()\n {\n var roa = new int?[] { }.AsImmutableOrNull();\n Assert.False(roa.SingleOrDefault().HasValue);\n roa = new int?[] { 1 }.AsImmutableOrNull();\n Assert.Equal(1, roa.SingleOrDefault());\n roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.Throws(() => roa.SingleOrDefault());\n roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();\n Assert.Equal(2, roa.SingleOrDefault(i => i == 2));\n }\n\n [Fact]\n public void Concat()\n {\n var empty = ImmutableArray.Create();\n var a = ImmutableArray.Create(0, 2, 4);\n\n Assert.Equal(empty, empty.Concat(empty));\n Assert.Equal(a, a.Concat(empty));\n Assert.Equal(a, empty.Concat(a));\n Assert.True(a.Concat(a).SequenceEqual(ImmutableArray.Create(0, 2, 4, 0, 2, 4)));\n }\n\n [Fact]\n public void AddRange()\n {\n var empty = ImmutableArray.Create();\n var a = ImmutableArray.Create(0, 2, 4);\n\n Assert.Equal(empty, empty.AddRange(empty));\n Assert.Equal(a, a.AddRange(empty));\n Assert.Equal(a, empty.AddRange(a));\n Assert.True(a.AddRange(a).SequenceEqual(ImmutableArray.Create(0, 2, 4, 0, 2, 4)));\n\n Assert.Equal(empty, empty.AddRange((IEnumerable)empty));\n Assert.Equal(a, a.AddRange((IEnumerable)empty));\n Assert.True(a.SequenceEqual(empty.AddRange((IEnumerable)a)));\n Assert.True(a.AddRange((IEnumerable)a).SequenceEqual(ImmutableArray.Create(0, 2, 4, 0, 2, 4)));\n }\n\n [Fact]\n public void InsertRange()\n {\n var empty = ImmutableArray.Create();\n var a = ImmutableArray.Create(0, 2, 4);\n\n Assert.Equal(empty, empty.InsertRange(0, empty));\n Assert.Equal(a, a.InsertRange(0, empty));\n Assert.Equal(a, a.InsertRange(2, empty));\n Assert.True(a.SequenceEqual(empty.InsertRange(0, a)));\n Assert.True(a.InsertRange(2, a).SequenceEqual(ImmutableArray.Create(0, 2, 0, 2, 4, 4)));\n }\n\n [Fact]\n public void ToDictionary()\n {\n var roa = new string[] { \"one:1\", \"two:2\", \"three:3\" }.AsImmutableOrNull();\n\n // Call extension method directly to resolve the ambiguity with EnumerableExtensions.ToDictionary\n var dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First());\n Assert.Equal(\"one:1\", dict[\"one\"]);\n Assert.Equal(\"two:2\", dict[\"two\"]);\n Assert.Equal(\"three:3\", dict[\"three\"]);\n Assert.Throws(() => dict[\"One\"]);\n\n dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), StringComparer.OrdinalIgnoreCase);\n Assert.Equal(\"one:1\", dict[\"one\"]);\n Assert.Equal(\"two:2\", dict[\"Two\"]);\n Assert.Equal(\"three:3\", dict[\"THREE\"]);\n Assert.Throws(() => dict[\"\"]);\n\n dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last());\n Assert.Equal(\"1\", dict[\"one\"]);\n Assert.Equal(\"2\", dict[\"two\"]);\n Assert.Equal(\"3\", dict[\"three\"]);\n Assert.Throws(() => dict[\"THREE\"]);\n\n dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last(), StringComparer.OrdinalIgnoreCase);\n Assert.Equal(\"1\", dict[\"onE\"]);\n Assert.Equal(\"2\", dict[\"Two\"]);\n Assert.Equal(\"3\", dict[\"three\"]);\n Assert.Throws(() => dict[\"four\"]);\n }\n\n [Fact]\n public void SequenceEqual()\n {\n var a = ImmutableArray.Create(\"A\", \"B\", \"C\");\n var b = ImmutableArray.Create(\"A\", \"b\", \"c\");\n var c = ImmutableArray.Create(\"A\", \"b\");\n Assert.False(a.SequenceEqual(b));\n Assert.True(a.SequenceEqual(b, StringComparer.OrdinalIgnoreCase));\n\n Assert.False(a.SequenceEqual(c));\n Assert.False(a.SequenceEqual(c, StringComparer.OrdinalIgnoreCase));\n Assert.False(c.SequenceEqual(a));\n\n var r = ImmutableArray.Create(1, 2, 3);\n Assert.True(r.SequenceEqual(Enumerable.Range(1, 3)));\n Assert.False(r.SequenceEqual(Enumerable.Range(1, 2)));\n Assert.False(r.SequenceEqual(Enumerable.Range(1, 4)));\n\n var s = ImmutableArray.Create(10, 20, 30);\n Assert.True(r.SequenceEqual(s, (x, y) => 10 * x == y));\n }\n\n [Fact]\n public void SelectAsArray()\n {\n var empty = ImmutableArray.Create