4383 references to SyntaxFactory
ConfigurationSchemaGenerator.Tests (2)
GeneratorTests.cs (2)
30private static readonly SyntaxTree s_implicitUsingsSyntaxTree = SyntaxFactory.ParseSyntaxTree(SourceText.From( 1561var sourceSyntaxTree = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceText));
IdeCoreBenchmarks (1)
SyntacticChangeRangeBenchmark.cs (1)
44_tree = SyntaxFactory.ParseSyntaxTree(_text);
InteractiveHost.UnitTests (1)
InteractiveHostDesktopTests.cs (1)
938new[] { SyntaxFactory.ParseSyntaxTree(source) },
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
376loggerParam = parameterSyntax.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.ThisKeyword))); 603var line = SyntaxFactory.ParseLeadingTrivia($@"
Microsoft.Analyzers.Extra.Tests (18)
SyntaxNodeExtensionsTests.cs (18)
21var node = SyntaxFactory.VariableDeclarator("v"); 47SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(codeStr); 79SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(codeStr); 99var node = SyntaxFactory.VariableDeclarator("v"); 107var node = SyntaxFactory.InvocationExpression(SyntaxFactory.IdentifierName("CheckGetFirstAncestorOfSyntaxKindReturnsNullWhenNodeIsNotfound")); 117var node = SyntaxFactory.IdentifierName("expectedName"); 142SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(codeStr); 173SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(codeStr); 186var console = SyntaxFactory.IdentifierName("Console"); 187var writeline = SyntaxFactory.IdentifierName("WriteLine"); 188var memberaccess = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, console, writeline); 189var expression = SyntaxFactory.InvocationExpression(memberaccess, SyntaxFactory.ArgumentList()); 197var b = SyntaxFactory.IdentifierName("b"); 198var memberbind = SyntaxFactory.MemberBindingExpression(SyntaxFactory.ParseToken("."), b); 199var expression = SyntaxFactory.InvocationExpression(memberbind);
Microsoft.AspNetCore.App.Analyzers.Test (2)
Infrastructure\AmbiguousRoutePatternComparerTests.cs (1)
81var parsedStatement = SyntaxFactory.ParseStatement(statement);
RouteEmbeddedLanguage\RoutePatternParserTests.cs (1)
35var parsedStatement = SyntaxFactory.ParseStatement(statement);
Microsoft.AspNetCore.App.CodeFixes (27)
Authorization\AddAuthorizationBuilderFixer.cs (12)
81SyntaxFactory.Identifier("AddAuthorizationBuilder")); 83invocation = SyntaxFactory.InvocationExpression(addAuthorizationBuilderMethod); 92SyntaxFactory.ArgumentList( 93SyntaxFactory.SeparatedList(configureArguments))); 101SyntaxFactory.ArgumentList( 102SyntaxFactory.SingletonSeparatedList( 103SyntaxFactory.Argument(assignmentExpression)))); 122SyntaxFactory.EndOfLine(Environment.NewLine), 123SyntaxFactory.Tab) 126return SyntaxFactory.InvocationExpression( 127SyntaxFactory.MemberAccessExpression( 130SyntaxFactory.IdentifierName(invokedMemberName)),
DetectMismatchedParameterOptionalityFixer.cs (1)
48var newParam = parameterSyntax.WithType(SyntaxFactory.NullableType(parameterType));
Http\HeaderDictionaryAddFixer.cs (5)
91invocation = invocationExpression.ReplaceToken(identifierToken, SyntaxFactory.Identifier("Append")); 124SyntaxFactory.AssignmentExpression( 126SyntaxFactory.ElementAccessExpression( 128SyntaxFactory.BracketedArgumentList( 129SyntaxFactory.SeparatedList(new[] { arguments[0] }))),
Http\HeaderDictionaryIndexerFixer.cs (2)
59var newExpression = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expression, SyntaxFactory.IdentifierName(resolvedPropertyName));
Kestrel\ListenOnIPv6AnyFixer.cs (1)
67.WithExpression(SyntaxFactory.ParseExpression($"{instanceVariableInvoked.ToString()}.ListenAnyIP"))
RouteParameterUnusedParameterFixer.cs (5)
22private static readonly TypeSyntax DefaultType = SyntaxFactory.ParseTypeName("string"); 84resolvedType = SyntaxFactory.NullableType(resolvedType); 89var newParameter = SyntaxFactory.Parameter(SyntaxFactory.Identifier(routeParameterName!)).WithType(type); 160return resolvedName != null ? SyntaxFactory.ParseTypeName(resolvedName) : DefaultType;
WebApplicationBuilderFixer.cs (1)
62if (!CanFixWebApplicationBuilder(diagnostic, SyntaxFactory.IdentifierName(identifierMethod), root, out var invocation))
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
Microsoft.AspNetCore.Mvc.Api.Analyzers (20)
AddResponseTypeAttributeCodeFixAction.cs (20)
120root = compilationUnit.AddUsings(SyntaxFactory.UsingDirective(SyntaxFactory.ParseName(@namespace))); 206return SyntaxFactory.Attribute( 207SyntaxFactory.ParseName(ApiSymbolNames.ProducesResponseTypeAttribute) 209SyntaxFactory.AttributeArgumentList().AddArguments( 211SyntaxFactory.AttributeArgument(statusCodeSyntax))); 218var responseTypeAttribute = SyntaxFactory.TypeOfExpression( 219SyntaxFactory.ParseTypeName(typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)) 222return SyntaxFactory.Attribute( 223SyntaxFactory.ParseName(ApiSymbolNames.ProducesResponseTypeAttribute) 225SyntaxFactory.AttributeArgumentList().AddArguments( 226SyntaxFactory.AttributeArgument(responseTypeAttribute), 227SyntaxFactory.AttributeArgument(statusCodeSyntax))); 235return SyntaxFactory.MemberAccessExpression( 237SyntaxFactory.ParseTypeName(ApiSymbolNames.HttpStatusCodes) 239SyntaxFactory.IdentifierName(constantName)); 243return SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(statusCode)); 248return SyntaxFactory.Attribute( 249SyntaxFactory.ParseName(ApiSymbolNames.ProducesDefaultResponseTypeAttribute)
Microsoft.CodeAnalysis.CSharp (171)
Binder\Binder_Expressions.cs (1)
11081var conditionalAccessNode = SyntaxFactory.FindConditionalAccessNodeForBinding(binding);
CommandLine\CSharpCompiler.cs (1)
207var tree = SyntaxFactory.ParseSyntaxTree(
Compilation\CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs (3)
49NameSyntax qualifiedName = SyntaxFactory.IdentifierName(identifiers[0]); 53qualifiedName = SyntaxFactory.QualifiedName(left: qualifiedName, right: SyntaxFactory.IdentifierName(identifiers[j]));
Compilation\CSharpSemanticModel.cs (5)
288expression = SyntaxFactory.GetStandaloneExpression(expression); 306var crefWrapper = SyntaxFactory.QualifiedCref(qualified.Left, SyntaxFactory.NameMemberCref(qualified.Right)); 312(CrefSyntax)SyntaxFactory.TypeCref(typeSyntax) : 313SyntaxFactory.NameMemberCref(typeSyntax);
Compilation\MemberSemanticModel.cs (4)
171var expression = SyntaxFactory.GetStandaloneExpression(type); 202expression = SyntaxFactory.GetStandaloneExpression(expression); 2219var tmp = SyntaxFactory.GetStandaloneNode(node); 2326bindableParent = SyntaxFactory.GetStandaloneExpression(arrayType);
Compilation\SyntaxAndDeclarationManager.cs (1)
241var loadedTree = SyntaxFactory.ParseSyntaxTree(
Compilation\SyntaxTreeSemanticModel.cs (5)
207node = SyntaxFactory.GetStandaloneNode(node); 308node = SyntaxFactory.GetStandaloneNode(node); 400node = SyntaxFactory.GetStandaloneNode(node); 409node = SyntaxFactory.GetStandaloneNode(node); 418node = SyntaxFactory.GetStandaloneNode(node);
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (2)
498CrefSyntax crefSyntax = SyntaxFactory.ParseCref(attributeValue); 621SyntaxTriviaList leadingTrivia = SyntaxFactory.ParseLeadingTrivia(commentText, CSharpParseOptions.Default.WithDocumentationMode(DocumentationMode.Diagnose));
CSharpExtensions.cs (1)
275return SyntaxFactory.TokenList(items);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
254var identifierName = SyntaxFactory.IdentifierName(symbol.Name); 293var token = SyntaxFactory.ParseToken(nameWithoutAttributeSuffix);
Syntax\CSharpSyntaxNode.cs (1)
517return SyntaxFactory.AreEquivalent(this, (CSharpSyntaxNode)node, topLevel);
Syntax\CSharpSyntaxRewriter.cs (1)
127return SyntaxFactory.Trivia(newStructure);
Syntax\CSharpSyntaxTree.cs (1)
128return SyntaxFactory.AreEquivalent(this, tree, topLevel);
Syntax\CSharpSyntaxTree.Dummy.cs (1)
25_node = this.CloneNodeAsRoot(SyntaxFactory.ParseCompilationUnit(string.Empty));
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
70var tree = SyntaxFactory.ParseSyntaxTree(_text, _options, _path, cancellationToken);
Syntax\DestructorDeclarationSyntax.cs (2)
46SyntaxFactory.Token(SyntaxKind.TildeToken), 80SyntaxFactory.Token(SyntaxKind.TildeToken),
Syntax\IndexerDeclarationSyntax.cs (1)
44return SyntaxFactory.IndexerDeclaration(
Syntax\InternalSyntax\CSharpSyntaxNode.cs (1)
242return CSharp.SyntaxFactory.Token(SyntaxKind.CommaToken);
Syntax\LambdaUtilities.cs (2)
243if (!SyntaxFactory.AreEquivalent(sourceIdentifier, selectorIdentifier)) 366return oldTokens.SequenceEqual(newTokens, SyntaxFactory.AreEquivalent);
Syntax\LiteralExpressionSyntax.cs (2)
14=> SyntaxFactory.LiteralExpression(kind, SyntaxFactory.Token(GetLiteralExpressionTokenKind(kind)));
Syntax\MethodDeclarationSyntax.cs (1)
39return SyntaxFactory.MethodDeclaration(
Syntax\NameColonSyntax.cs (1)
17return SyntaxFactory.ExpressionColon(expression, this.ColonToken);
Syntax\ParenthesizedLambdaExpressionSyntax.cs (3)
52=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists: default, modifiers, returnType: null, parameterList, arrowToken, block, expressionBody); 55=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists: default, modifiers, parameterList, block, expressionBody); 58=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType: null, parameterList, block, expressionBody);
Syntax\PropertyDeclarationSyntax.cs (2)
46return SyntaxFactory.AccessorDeclaration(kind, default(SyntaxList<AttributeListSyntax>), default(SyntaxTokenList), SyntaxFactory.Token(GetAccessorDeclarationKeywordKind(kind)), body, expressionBody: null, default(SyntaxToken));
Syntax\SyntaxExtensions.cs (1)
128return SyntaxFactory.TriviaList(sequence);
Syntax\SyntaxFactory.cs (92)
2104return SyntaxFactory.GetStandaloneNode(expression) as ExpressionSyntax ?? expression; 2287return SyntaxFactory.BinaryExpression(expression.Kind(), max.Expression, max.OperatorToken, SyntaxFactory.IdentifierName(gn.Identifier)); 2295return SyntaxFactory.QualifiedName(qn.Left, qn.DotToken, SyntaxFactory.IdentifierName(gn.Identifier)); 2303return SyntaxFactory.AliasQualifiedName(an.Alias, an.ColonColonToken, SyntaxFactory.IdentifierName(gn.Identifier)); 2429return SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, SyntaxFactory.Token(SyntaxKind.ColonToken)); 2435return SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.ColonToken)); 2458return SyntaxFactory.PropertyDeclaration( 2479return SyntaxFactory.ConversionOperatorDeclaration( 2501return SyntaxFactory.ConversionOperatorDeclaration( 2523return SyntaxFactory.ConversionOperatorDeclaration( 2547return SyntaxFactory.ConversionOperatorDeclaration( 2572return SyntaxFactory.OperatorDeclaration( 2596return SyntaxFactory.OperatorDeclaration( 2619return SyntaxFactory.OperatorDeclaration( 2643return SyntaxFactory.OperatorDeclaration( 2688=> SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, body, expressionBody: null); 2690=> SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, keyword, body, expressionBody: null, semicolonToken); 2692=> SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, body: null, expressionBody); 2694=> SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, keyword, body: null, expressionBody, semicolonToken); 2724var openParen = needsParens ? SyntaxFactory.Token(SyntaxKind.OpenParenToken) : default; 2725var closeParen = needsParens ? SyntaxFactory.Token(SyntaxKind.CloseParenToken) : default; 2726return SyntaxFactory.SwitchStatement( 2728SyntaxFactory.Token(SyntaxKind.SwitchKeyword), 2732SyntaxFactory.Token(SyntaxKind.OpenBraceToken), 2734SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 2740return SyntaxFactory.SwitchStatement(expression, default(SyntaxList<SwitchSectionSyntax>)); 2771? AnonymousMethodExpression(default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), parameterList, block, null) 2838return SyntaxFactory.OperatorMemberCref( 2848return SyntaxFactory.ConversionOperatorMemberCref( 2859return SyntaxFactory.ClassDeclaration( 2868return SyntaxFactory.ClassDeclaration(attributeLists, modifiers, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, members); 2873=> SyntaxFactory.ClassDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.ClassKeyword), identifier, typeParameterList, parameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2877=> SyntaxFactory.ClassDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ClassKeyword), identifier, null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2881=> SyntaxFactory.ClassDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ClassKeyword), SyntaxFactory.Identifier(identifier), null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2886return SyntaxFactory.StructDeclaration( 2895return SyntaxFactory.StructDeclaration(attributeLists, modifiers, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, members); 2900=> SyntaxFactory.StructDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, typeParameterList, parameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2904=> SyntaxFactory.StructDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2908=> SyntaxFactory.StructDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.StructKeyword), SyntaxFactory.Identifier(identifier), null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2918=> SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), identifier, typeParameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2922=> SyntaxFactory.InterfaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), identifier, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2926=> SyntaxFactory.InterfaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), SyntaxFactory.Identifier(identifier), null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2930=> SyntaxFactory.EnumDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EnumKeyword), identifier, baseList, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2934=> SyntaxFactory.EnumDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EnumKeyword), identifier, null, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2938=> SyntaxFactory.EnumDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EnumKeyword), SyntaxFactory.Identifier(identifier), null, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default);
Syntax\SyntaxFacts.cs (4)
56node = (ExpressionSyntax)SyntaxFactory.GetStandaloneExpression(node); 66node = (ExpressionSyntax)SyntaxFactory.GetStandaloneExpression(node); 84node = SyntaxFactory.GetStandaloneExpression(node); 244node = SyntaxFactory.GetStandaloneExpression(node);
Syntax\SyntaxNodeRemover.cs (9)
102this.AddEndOfLine(GetEndOfLine(trivia) ?? SyntaxFactory.CarriageReturnLineFeed); 320this.AddResidualTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker)); 360this.AddResidualTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker)); 400this.AddResidualTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker)); 475AddResidualTrivia(SyntaxFactory.TriviaList(indentationTrivia, parentTrivia), requiresNewLine: true); 479AddResidualTrivia(SyntaxFactory.TriviaList(parentTrivia), requiresNewLine: true);
Syntax\SyntaxNormalizer.cs (9)
41_eolTrivia = useElasticTrivia ? SyntaxFactory.ElasticEndOfLine(eolWhitespace) : SyntaxFactory.EndOfLine(eolWhitespace); 166_indentations.Add(_useElasticTrivia ? SyntaxFactory.ElasticWhitespace(text) : SyntaxFactory.Whitespace(text)); 1121return SyntaxFactory.TriviaList(currentTriviaList.First()); 1125return SyntaxFactory.TriviaList(currentTriviaList); 1134private static readonly SyntaxTrivia s_trimmedDocCommentExterior = SyntaxFactory.DocumentationCommentExterior("///"); 1138return _useElasticTrivia ? SyntaxFactory.ElasticSpace : SyntaxFactory.Space;
Syntax\TypeDeclarationSyntax.cs (11)
91SyntaxFactory.Token(GetTypeDeclarationKeywordKind(kind)), 96SyntaxFactory.Token(SyntaxKind.OpenBraceToken), 98SyntaxFactory.Token(SyntaxKind.CloseBraceToken), 104return SyntaxFactory.TypeDeclaration(kind, SyntaxFactory.Identifier(identifier)); 124return SyntaxFactory.ClassDeclaration(attributes, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 126return SyntaxFactory.StructDeclaration(attributes, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 128return SyntaxFactory.InterfaceDeclaration(attributes, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 130return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, attributes, modifiers, keyword, classOrStructKeyword: default, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 132return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordStructDeclaration, attributes, modifiers, keyword, classOrStructKeyword: SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (54)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
256if (!SyntaxFactory.AreEquivalent(node.Left, _assignmentTargetOpt))
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
149if (SyntaxFactory.AreEquivalent(expression, invocationExpression.Expression, topLevel: false)) 154SyntaxFactory.AreEquivalent(expression, memberAccessExpression.Expression, topLevel: false))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
27using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
16using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
12using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
201if (!SyntaxFactory.AreEquivalent(isExpression.Left.WalkDownParentheses(), castExpression.Expression.WalkDownParentheses(), topLevel: false) || 202!SyntaxFactory.AreEquivalent(isExpression.Right.WalkDownParentheses(), castExpression.Type, topLevel: false))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (1)
7using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (1)
18return [SyntaxFactory.Token(argument.RefKindKeyword.Kind())];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (1)
27block = SyntaxFactory.Block(statement);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
95var parsed = SyntaxFactory.ParseStatement(nextTrivia.ToFullString()); 131arrowExpression = SyntaxFactory.ArrowExpressionClause(expression); 206expression = SyntaxFactory.ThrowExpression(throwStatement.ThrowKeyword, throwStatement.Expression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (1)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
877return SyntaxFactory.ThrowStatement(throwExpression.ThrowKeyword, throwExpression.Expression, semicolonToken); 883return SyntaxFactory.ReturnStatement(expression.WithLeadingTrivia(SyntaxFactory.ElasticSpace)) 886.WithPrependedLeadingTrivia(SyntaxFactory.ElasticMarker); 890return SyntaxFactory.ReturnStatement(expression) 896return SyntaxFactory.ExpressionStatement(expression)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
107var expr = SyntaxFactory.GetStandaloneExpression(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (5)
34token = token.WithLeadingTrivia(SyntaxFactory.ElasticSpace); 38token = token.WithLeadingTrivia(SyntaxFactory.Space); 46token = token.WithTrailingTrivia(SyntaxFactory.ElasticSpace); 50token = token.WithTrailingTrivia(SyntaxFactory.Space); 65token = SyntaxFactory.Token(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
239var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
142=> SyntaxFactory.ParseLeadingTrivia(s ?? string.Empty); 185yield return SyntaxFactory.ElasticMarker;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (5)
50=> SyntaxFactory.Whitespace(text); 56_newLine = SyntaxFactory.EndOfLine(Context.Options.NewLine); 224var multilineCommentTrivia = SyntaxFactory.ParseLeadingTrivia(multiLineComment); 338var formattedTrivia = SyntaxFactory.Trivia((StructuredTriviaSyntax)result.GetFormattedRoot(cancellationToken)); 372var formattedTrivia = SyntaxFactory.Trivia((StructuredTriviaSyntax)result.GetFormattedRoot(cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
57var parsedNewTrivia = SyntaxFactory.DocumentationCommentExterior(newTriviaText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (3)
91var trailingTrivia = SyntaxFactory.ParseTrailingTrivia(text); 94var leadingTrivia = SyntaxFactory.ParseLeadingTrivia(text[width..]); 147return SyntaxFactory.ParseLeadingTrivia(text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (1)
23? SyntaxFactory.Comment(text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (9)
41=> SyntaxFactory.ElasticMarker; 44=> SyntaxFactory.ElasticCarriageReturnLineFeed; 80=> SyntaxFactory.ParseToken(text); 83=> SyntaxFactory.ParseLeadingTrivia(text); 175=> node is ExpressionSyntax expression ? SyntaxFactory.GetStandaloneExpression(expression) : node; 467var token = SyntaxFactory.ParseToken(identifier); 473var token = SyntaxFactory.ParseToken(identifier); 1350=> SyntaxFactory.AreEquivalent(token1, token2); 1353=> SyntaxFactory.AreEquivalent(node1, node2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
103var candidateReplacementNode = SyntaxFactory.IdentifierName("var"); 193SyntaxFactory.IdentifierName("var").WithTriviaFrom(declarationTypeNode).WithAdditionalAnnotations(annotation));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (168)
src\Analyzers\CSharp\CodeFixes\AddAnonymousTypeMemberName\CSharpAddAnonymousTypeMemberNameCodeFixProvider.cs (2)
38SyntaxFactory.NameEquals( 39SyntaxFactory.IdentifierName(name)));
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
47return embeddedStatement is null ? currentStatement : currentStatement.ReplaceNode(embeddedStatement, SyntaxFactory.Block(embeddedStatement));
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (2)
59var newBody = SyntaxFactory.Block(statements.Add(exprOrStatement).Cast<StatementSyntax>()); 79var newBody = SyntaxFactory.Block(statements.Add(generator.ReturnStatement(exprOrStatement)).Cast<StatementSyntax>());
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
18using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
98SyntaxFactory.ParseTypeName("Task")
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
412return SyntaxFactory.LiteralExpression(
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (4)
75var newDocCommentNode = SyntaxFactory.DocumentationComment(SyntaxFactory.XmlParamElement(parameterName)); 81return elementNode.WithTrailingTrivia(SyntaxFactory.ParseTrailingTrivia(Environment.NewLine)); 85SyntaxFactory.ParseLeadingTrivia(Environment.NewLine)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
41=> SyntaxFactory.ParseLeadingTrivia(docCommentText);
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
105clause.Constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
65identifierToken = SyntaxFactory.Token( 91identifierToken = SyntaxFactory.Token(
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
103var methodDecl = SyntaxFactory.DestructorDeclaration(classType.Name).AddBodyStatements(disposeStatement);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
28using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
74var yieldStatement = SyntaxFactory.YieldStatement(
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (1)
64newReturnType = SyntaxFactory.PredefinedType(VoidKeyword).WithTriviaFrom(returnTypeSyntax);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
366var newFirstMember = firstMember.WithLeadingTrivia(firstMemberTrivia.Insert(0, SyntaxFactory.CarriageReturnLineFeed));
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
78.WithTrailingTrivia(SyntaxFactory.Space); 97replacementMap[colonToken] = colonToken.WithLeadingTrivia(thisBaseKeyword.LeadingTrivia).WithTrailingTrivia(SyntaxFactory.Space);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
106var fixedDeclaration = SyntaxFactory.NullableType(declarationTypeToFix.WithoutTrivia()).WithTriviaFrom(declarationTypeToFix);
src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
16using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
38var block = SyntaxFactory.Block(statement);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (2)
53return SyntaxFactory.BinaryExpression( 66SyntaxFactory.TypePattern(((DeclarationPatternSyntax)current).Type)
src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (1)
87editor.ReplaceNode(statement, SyntaxFactory.Block());
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (1)
19using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (3)
59var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1)); 65.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil))) 69.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
32using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (4)
23=> SyntaxFactory.Token(kind); 28return SyntaxFactory.AssignmentExpression(assignmentOpKind, left, syntaxToken, right); 42=> SyntaxFactory.PostfixUnaryExpression(kind, operand); 45=> SyntaxFactory.PrefixUnaryExpression(kind, operand);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
35=> variable.WithInitializer(SyntaxFactory.EqualsValueClause(value));
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionHelpers.cs (1)
17return SyntaxFactory.ThrowExpression(throwStatement.ThrowKeyword, throwStatement.Expression);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
60SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
18using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
50var implicitType = SyntaxFactory.IdentifierName("var")
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
16=> SyntaxFactory.PrefixUnaryExpression(
src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
57var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
15using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
18using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
30using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
56=> SyntaxFactory.ElementBindingExpression(argumentList);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (2)
21using static SyntaxFactory; 47=> SyntaxFactory.Whitespace(text);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
12using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
26using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (5)
61var updatedCondition = SyntaxFactory.IsPatternExpression( 62isExpression.Left, SyntaxFactory.DeclarationPattern( 64SyntaxFactory.SingleVariableDesignation( 69.SelectMany(t => ImmutableArray.Create(SyntaxFactory.Space, t, SyntaxFactory.ElasticCarriageReturnLineFeed))
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
33using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ArgumentGenerator.cs (3)
17return SyntaxFactory.Argument(expression); 24=> SyntaxFactory.ArgumentList([.. arguments.Select(GenerateArgument)]); 27=> SyntaxFactory.BracketedArgumentList([.. arguments.Select(GenerateArgument)]);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
18using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
19using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
17using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
23using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
26using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
17using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
22using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
19using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
16using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
22using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
20return SyntaxFactory.Block(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
14using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
14using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (1)
13using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
12using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
18using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\QueryExpressionSyntaxExtensions.cs (1)
44var clauses = SyntaxFactory.List(allClauses.Take(allClauses.Count() - 1).Cast<QueryClauseSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (2)
28: SyntaxFactory.SeparatedList<T>(newList.GetWithSeparators().Add(SyntaxFactory.Token(separator)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (3)
39return SyntaxFactory.Identifier(escaped); 46var token = SyntaxFactory.Identifier( 58=> SyntaxFactory.IdentifierName(identifier.ToIdentifierToken());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
102var leadingTrivia = prependNewLineIfMissing ? token.LeadingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.LeadingTrivia; 103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 104return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(Formatter.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
84=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
25using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (38)
34=> SyntaxFactory.CarriageReturnLineFeed; 37=> SyntaxFactory.ElasticCarriageReturnLineFeed; 46=> SyntaxFactory.EndOfLine(text); 49=> SyntaxFactory.Comment("//" + text); 53return SyntaxFactory.LocalDeclarationStatement( 62=> SyntaxFactory.EqualsValueClause(operatorToken, (ExpressionSyntax)value); 66return SyntaxFactory.VariableDeclaration( 67type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 68[SyntaxFactory.VariableDeclarator( 70expression == null ? null : SyntaxFactory.EqualsValueClause((ExpressionSyntax)expression))]); 74=> SyntaxFactory.Identifier(identifier); 77=> SyntaxFactory.ConditionalAccessExpression((ExpressionSyntax)expression, (ExpressionSyntax)whenNotNull); 80=> SyntaxFactory.MemberBindingExpression((SimpleNameSyntax)name); 83=> SyntaxFactory.RefExpression((ExpressionSyntax)expression); 97=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 106=> SyntaxFactory.InterpolatedStringExpression(startToken, [.. content.Cast<InterpolatedStringContentSyntax>()], endToken); 109=> SyntaxFactory.InterpolatedStringText(textToken); 112=> SyntaxFactory.Token( 119=> SyntaxFactory.Interpolation((ExpressionSyntax)syntaxNode); 122=> SyntaxFactory.InterpolationAlignmentClause(CommaToken, (ExpressionSyntax)alignment); 125=> SyntaxFactory.InterpolationFormatClause( 127SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 130=> SyntaxFactory.TypeParameterList([.. typeParameterNames.Select(SyntaxFactory.TypeParameter)]); 175return SyntaxFactory.TokenList(result); 198=> SyntaxFactory.IsPatternExpression( 204=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)Parenthesize(left), (PatternSyntax)Parenthesize(right)); 207=> SyntaxFactory.ConstantPattern((ExpressionSyntax)expression); 210=> SyntaxFactory.DeclarationPattern( 212SyntaxFactory.SingleVariableDesignation(name.ToIdentifierToken())); 215=> SyntaxFactory.RelationalPattern(LessThanToken, (ExpressionSyntax)expression); 218=> SyntaxFactory.RelationalPattern(LessThanEqualsToken, (ExpressionSyntax)expression); 221=> SyntaxFactory.RelationalPattern(GreaterThanToken, (ExpressionSyntax)expression); 224=> SyntaxFactory.RelationalPattern(GreaterThanEqualsToken, (ExpressionSyntax)expression); 227=> SyntaxFactory.UnaryPattern(NotKeyword, (PatternSyntax)Parenthesize(pattern)); 230=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)Parenthesize(left), (PatternSyntax)Parenthesize(right)); 236=> SyntaxFactory.TypePattern((TypeSyntax)type); 239=> SyntaxFactory.UnaryPattern(operatorToken, (PatternSyntax)Parenthesize(pattern));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
27using static SyntaxFactory; 276.AddAccessorListAccessors(SyntaxFactory
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (2)
49SyntaxFactory.VerbatimIdentifier( 85tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(Formatter.Annotation);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (9)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (5)
176BaseFieldDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 177BaseMethodDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 178BasePropertyDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 179StatementSyntax => SyntaxFactory.ParseStatement(textToParse, options: (CSharpParseOptions)tree.Options), 180UsingDirectiveSyntax => SyntaxFactory.ParseCompilationUnit(textToParse, options: (CSharpParseOptions)tree.Options),
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (1)
21using static SyntaxFactory;
Interactive\CSharpInteractiveEvaluatorLanguageInfoProvider.cs (2)
48=> SyntaxFactory.IsCompleteSubmission(SyntaxFactory.ParseSyntaxTree(SourceText.From(text, encoding: null, SourceHashAlgorithms.Default), options: s_parseOptions));
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
31var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(code, encoding: null, SourceHashAlgorithms.Default), options);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (23)
Debugging\ProximityExpressionsGetterTests.cs (2)
39=> SyntaxFactory.ParseSyntaxTree(GetTestFileContent()); 42=> SyntaxFactory.ParseSyntaxTree(code);
Diagnostics\FixAllProvider\BatchFixerTests.cs (2)
77var newNode = SyntaxFactory.MemberAccessExpression( 79SyntaxFactory.ThisExpression(),
Extensions\ContextQuery\AbstractContextTests.cs (3)
39var tree = SyntaxFactory.ParseSyntaxTree(text, options: options); 61var tree = SyntaxFactory.ParseSyntaxTree(text, options: options); 88var tree = SyntaxFactory.ParseSyntaxTree(text, options: options);
ExtractMethod\ExtractMethodMiscellaneousTests.cs (2)
43var root = SyntaxFactory.ParseCompilationUnit(code); 88var root = SyntaxFactory.ParseCompilationUnit(code);
Formatting\CSharpFormattingEngineTestBase.cs (1)
23=> SyntaxFactory.ParseCompilationUnit(expected);
Formatting\FormattingEngineTests.cs (5)
1735var node = SyntaxFactory.ParseExpression(code); 2219var tree = SyntaxFactory.ParseSyntaxTree(code, options: TestOptions.Script); 2222var entry = SyntaxFactory.BinaryExpression(SyntaxKind.EqualsExpression, SyntaxFactory.LiteralExpression(SyntaxKind.TrueLiteralExpression), SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression));
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (1)
272.AddSyntaxTrees(sources.Select((s, i) => SyntaxFactory.ParseSyntaxTree(s, options: parseOptions, path: sourceCodePaths[i])))
Semantics\SpeculationAnalyzerTests.cs (1)
522=> SyntaxFactory.ParseSyntaxTree(text);
SymbolKey\SymbolKeyCompilationsTests.cs (6)
330var originalComp = CreateCompilation([SyntaxFactory.ParseSyntaxTree(src1, path: "file1.cs"), SyntaxFactory.ParseSyntaxTree(src1, path: "file2.cs")], assemblyName: "Test"); 331var newComp = CreateCompilation([SyntaxFactory.ParseSyntaxTree(src1, path: "file1.cs"), SyntaxFactory.ParseSyntaxTree(src1, path: "file2.cs")], assemblyName: "Test"); 344var src1 = SyntaxFactory.ParseSyntaxTree(""" 353var src2 = SyntaxFactory.ParseSyntaxTree("""
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (3)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (1)
35var parsedStatement = SyntaxFactory.ParseStatement(statement);
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
33var parsedStatement = SyntaxFactory.ParseStatement(statement);
Recommendations\RecommenderTests.cs (1)
63var tree = SyntaxFactory.ParseSyntaxTree(text, options: options);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (36)
BreakingChanges.cs (2)
26SyntaxFactory.ParseSyntaxTree(test).GetDiagnostics().Verify(Diagnostic(ErrorCode.ERR_PPDirectiveExpected, @"de\u0066in\U00000065")); 279SyntaxFactory.ParseSyntaxTree(test).GetDiagnostics().Verify(Diagnostic(ErrorCode.ERR_GlobalAttributesNotFirst, "assembly"));
CodeGen\CodeGenAsyncTests.cs (3)
4542var s0 = CSharpCompilation.CreateScriptCompilation("s0.dll", SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script), references); 4543var s1 = CSharpCompilation.CreateScriptCompilation("s1.dll", SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.Script), references, previousScriptCompilation: s0); 4553var s0 = CSharpCompilation.CreateScriptCompilation("s0.dll", SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script), references);
CodeGen\CodeGenCheckedTests.cs (2)
2918var nodeToSpeculate = SyntaxFactory.ParseExpression("x + y"); 2950var nodeToSpeculate = SyntaxFactory.ParseExpression("x + y");
CodeGen\CodeGenFieldInitTests.cs (1)
654trees.Add(SyntaxFactory.ParseSyntaxTree("System.Console.WriteLine(" + i + ");", options: TestOptions.Script));
CodeGen\CodeGenScriptTests.cs (10)
25var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 44var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 62var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 88var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 113var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 138var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 169var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 197var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 555SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script), 636var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script);
CodeGen\CodeGenTupleTest.cs (2)
22613var startTree = SyntaxFactory.ParseSyntaxTree(text); 24009var tree = SyntaxFactory.ParseSyntaxTree(text, CSharpParseOptions.Default);
CodeGen\GotoTest.cs (4)
1000var s0 = CSharpCompilation.CreateScriptCompilation("s0.dll", SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script), references); 1002var s1 = CSharpCompilation.CreateScriptCompilation("s1.dll", SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.Script), references, previousScriptCompilation: s0); 1111var s0 = CSharpCompilation.CreateScriptCompilation("s0.dll", SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script), references); 1113var s1 = CSharpCompilation.CreateScriptCompilation("s1.dll", SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.Script), references, previousScriptCompilation: s0);
Emit\CompilationEmitTests.cs (1)
4046syntaxTrees: [SyntaxFactory.ParseSyntaxTree("class A { }")],
Emit\EmitMetadataTests.cs (2)
2230var syntax = SyntaxFactory.ParseSyntaxTree(@"class C {}", TestOptions.Regular.WithNoRefSafetyRulesAttribute()); 2419var syntax = SyntaxFactory.ParseSyntaxTree(@"class C { static void Main() { } }", TestOptions.Regular.WithNoRefSafetyRulesAttribute());
Emit\EntryPointTests.cs (9)
374SyntaxFactory.ParseSyntaxTree(csx, options: TestOptions.Script), 395SyntaxFactory.ParseSyntaxTree(csx, options: TestOptions.Script), 726new[] { SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Script) }, 749SyntaxFactory.ParseSyntaxTree(csx, options: TestOptions.Script), 750SyntaxFactory.ParseSyntaxTree(cs, options: TestOptions.Regular) 783SyntaxFactory.ParseSyntaxTree(csx, options: TestOptions.Script), 784SyntaxFactory.ParseSyntaxTree(cs, options: TestOptions.Regular) 930SyntaxFactory.ParseSyntaxTree(csx, options: TestOptions.Script), 931SyntaxFactory.ParseSyntaxTree(cs, options: TestOptions.Regular),
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (16)
Emit\EditAndContinue\EditAndContinueTestBase.cs (2)
97if (!SyntaxFactory.AreEquivalent(s0, s1)) 104if (SyntaxFactory.AreEquivalent(p0, p1))
PDB\CheckSumTest.cs (2)
34var tree1 = SyntaxFactory.ParseSyntaxTree(StringText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), path: "sha1.cs"); 35var tree256 = SyntaxFactory.ParseSyntaxTree(StringText.From(source256, Encoding.UTF8, SourceHashAlgorithm.Sha256), path: "sha256.cs");
PDB\PDBTests.cs (11)
45var tree1 = SyntaxFactory.ParseSyntaxTree("class A { }", encoding: null, path: "Foo.cs"); 46var tree2 = SyntaxFactory.ParseSyntaxTree("class B { }", encoding: null, path: ""); 47var tree3 = SyntaxFactory.ParseSyntaxTree(SourceText.From("class C { }", encoding: null), path: "Bar.cs"); 48var tree4 = SyntaxFactory.ParseSyntaxTree("class D { }", encoding: Encoding.UTF8, path: "Baz.cs"); 65var tree1 = SyntaxFactory.ParseSyntaxTree("class A { public void F() { } }", encoding: Encoding.Unicode, path: "Foo.cs"); 66var tree2 = SyntaxFactory.ParseSyntaxTree("class B { public void F() { } }", encoding: null, path: ""); 67var tree3 = SyntaxFactory.ParseSyntaxTree("class C { public void F() { } }", encoding: new UTF8Encoding(true, false), path: "Bar.cs"); 68var tree4 = SyntaxFactory.ParseSyntaxTree(SourceText.From("class D { public void F() { } }", new UTF8Encoding(false, false)), path: "Baz.cs"); 132var tree1 = SyntaxFactory.ParseCompilationUnit(@" 136var tree2 = SyntaxFactory.ParseCompilationUnit(@" 12307var tree = SyntaxFactory.ParseSyntaxTree(source, encoding: Encoding.UTF8, path: "HIDDEN.cs");
PDB\TypeDefinitionDocumentTests.cs (1)
463var trees = sources.Select((s, i) => SyntaxFactory.ParseSyntaxTree(s, path: $"{i + 1}.cs", encoding: Encoding.UTF8)).ToArray();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (101)
Attributes\AttributeTests.cs (18)
53var typeForwardedTo = SyntaxFactory.Attribute(SyntaxFactory.ParseName("TypeForwardedTo")); 54var typeIdentifier = SyntaxFactory.Attribute(SyntaxFactory.ParseName("TypeIdentifier")); 64var alias1 = SyntaxFactory.Attribute(SyntaxFactory.ParseName("alias1")); 74var alias2 = SyntaxFactory.Attribute(SyntaxFactory.ParseName("alias2")); 81var alias3 = SyntaxFactory.Attribute(SyntaxFactory.ParseName("alias3")); 751var newRoot = root.ReplaceNode(attrSyntax, attrSyntax.WithArgumentList(SyntaxFactory.ParseAttributeArgumentList("()"))); 773var result = SyntaxFactory.ParseAttributeArgumentList("[]"); 783var result = SyntaxFactory.ParseAttributeArgumentList("[]", consumeFullText: false); 816var newRoot = root.ReplaceNode(attrSyntax, attrSyntax.WithArgumentList(SyntaxFactory.ParseAttributeArgumentList("()"))); 857var newRoot = root.ReplaceNode(attrSyntax, attrSyntax.WithArgumentList(SyntaxFactory.ParseAttributeArgumentList("()"))); 898var newRoot = root.ReplaceNode(attrSyntax, attrSyntax.WithArgumentList(SyntaxFactory.ParseAttributeArgumentList("()"))); 937var newRoot = root.ReplaceNode(attrSyntax, attrSyntax.WithArgumentList(SyntaxFactory.ParseAttributeArgumentList("()"))); 4889SyntaxFactory.ParseSyntaxTree(
Attributes\AttributeTests_CallerInfoAttributes.cs (16)
4169SyntaxFactory.ParseSyntaxTree(source1, path: @"C:\filename", encoding: Encoding.UTF8), 4170SyntaxFactory.ParseSyntaxTree(source2, path: @"a\b\..\c\d", encoding: Encoding.UTF8), 4171SyntaxFactory.ParseSyntaxTree(source3, path: @"*", encoding: Encoding.UTF8), 4172SyntaxFactory.ParseSyntaxTree(source4, path: @" ", encoding: Encoding.UTF8), 4211SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.Regular9, path: @"C:\filename", encoding: Encoding.UTF8) 4264SyntaxFactory.ParseSyntaxTree(source1, path: @"C:\filename", encoding: Encoding.UTF8), 4265SyntaxFactory.ParseSyntaxTree(source2, path: @"a\b\..\c\d.cs", encoding: Encoding.UTF8), 4266SyntaxFactory.ParseSyntaxTree(source3, path: @"*", encoding: Encoding.UTF8), 4267SyntaxFactory.ParseSyntaxTree(source4, path: @"C:\x.cs", encoding: Encoding.UTF8), 4268SyntaxFactory.ParseSyntaxTree(source5, path: @"C:\x.cs", encoding: Encoding.UTF8), 5171new[] { SyntaxFactory.ParseSyntaxTree(source, path: @"C:\filename", encoding: Encoding.UTF8) }, 5222new[] { SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular7, path: @"C:\filename", encoding: Encoding.UTF8) }, 5292var compilation = CreateCompilationWithMscorlib461(new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular7, path: @"C:\filename") }).VerifyDiagnostics( 5555new[] { SyntaxFactory.ParseSyntaxTree(source, path: @"C:\filename", encoding: Encoding.UTF8) }, 5615new[] { SyntaxFactory.ParseSyntaxTree(source, path: @"C:\filename", encoding: Encoding.UTF8) }, 5670new[] { SyntaxFactory.ParseSyntaxTree(csSource, path: @"C:\filename", encoding: Encoding.UTF8) },
Attributes\AttributeTests_Conditional.cs (4)
250CompilationUnitSyntax root = SyntaxFactory.ParseCompilationUnit(testSource); 251var syntaxTree = SyntaxFactory.SyntaxTree(root); 461CompilationUnitSyntax root = SyntaxFactory.ParseCompilationUnit(testSource); 462var syntaxTree = SyntaxFactory.SyntaxTree(root);
Attributes\AttributeTests_RefReadOnly.cs (4)
1381var newInvocation = SyntaxFactory.ParseExpression("Process((in int x) => x)"); 1423var newInvocation = SyntaxFactory.ParseExpression("Process(() => ref x)"); 1452var localfunction = SyntaxFactory.ParseStatement("int localFunction(in int x) { return x; }"); 1479var localfunction = SyntaxFactory.ParseStatement("ref readonly int localFunction(int x) { return ref x; }");
FieldKeywordTests.cs (2)
10492var modifiedTree = SyntaxFactory.ParseSyntaxTree(source.Replace("return null;", "return field;"), parseOptions); 10526var modifiedTree = SyntaxFactory.ParseSyntaxTree(source.Replace("return null;", "return field;"), parseOptions);
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
900var tree = SyntaxFactory.ParseSyntaxTree(@"
FlowAnalysis\RegionAnalysisTests.cs (1)
5483var tree = SyntaxFactory.ParseSyntaxTree(source);
Semantics\OutVarTests.cs (34)
3458ArgumentListSyntax arguments = SyntaxFactory.ParseArgumentList(@"(TakeOutParam(o, out int x1) && x1 >= 5)"); 3459var initializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer, arguments); 3499ArgumentListSyntax arguments = SyntaxFactory.ParseArgumentList(@"(TakeOutParam(o, out int x1) && x1 >= 5)"); 3500var initializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, arguments); 4000var statement = (DoStatementSyntax)SyntaxFactory.ParseStatement(@" 5106var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 8800var statement = (IfStatementSyntax)SyntaxFactory.ParseStatement(@" 9639var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@" 10207var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 10856var statement = (LockStatementSyntax)SyntaxFactory.ParseStatement(@" 13336var statement = (ReturnStatementSyntax)SyntaxFactory.ParseStatement(@" 13735var statement = (SwitchStatementSyntax)SyntaxFactory.ParseStatement(@" 15256var statement = (ThrowStatementSyntax)SyntaxFactory.ParseStatement(@" 16534var statement = (WhileStatementSyntax)SyntaxFactory.ParseStatement(@" 17093var statement = (YieldStatementSyntax)SyntaxFactory.ParseStatement(@" 17529var statement = (LabeledStatementSyntax)SyntaxFactory.ParseStatement(@" 21295var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@" 32505var node0 = SyntaxFactory.ParseCompilationUnit(source); 32507var decl = SyntaxFactory.DeclarationExpression( 32508type: SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("var")), 32509designation: SyntaxFactory.SingleVariableDesignation(SyntaxFactory.Identifier("x1"))); 34333.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>( 34334SyntaxFactory.NodeOrTokenList( 34335SyntaxFactory.ParseExpression($"TakeOutParam(true, out var x{i + 1})"), 34336SyntaxFactory.Token(SyntaxKind.CommaToken), 34337SyntaxFactory.ParseExpression($"x{i + 1}") 34547.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>( 34548SyntaxFactory.NodeOrTokenList( 34549SyntaxFactory.ParseExpression($"TakeOutParam(true, out var x{i + 1})"), 34550SyntaxFactory.Token(SyntaxKind.CommaToken), 34551SyntaxFactory.ParseExpression($"x{i + 1}") 35665var statementAfter = SyntaxFactory.ParseStatement(@"G(out _);");
Semantics\PatternMatchingTests.cs (4)
4173SyntaxFactory.ParseExpression("A is B < C, D > E").GetDiagnostics().Verify(); 4174SyntaxFactory.ParseExpression("A as B < C, D > E").GetDiagnostics().Verify( 4180SyntaxFactory.ParseExpression("A as B < C, D > ?? string.Empty").GetDiagnostics().Verify(); 4181SyntaxFactory.ParseExpression("A is B < C, D > ?? string.Empty").GetDiagnostics().Verify(
Semantics\PatternMatchingTests_Scope.cs (13)
403var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 708var statement = (ReturnStatementSyntax)SyntaxFactory.ParseStatement(@" 977var statement = (ThrowStatementSyntax)SyntaxFactory.ParseStatement(@" 1281var statement = (IfStatementSyntax)SyntaxFactory.ParseStatement(@" 5337var statement = (SwitchStatementSyntax)SyntaxFactory.ParseStatement(@" 6467var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@" 6880var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 7207var statement = (WhileStatementSyntax)SyntaxFactory.ParseStatement(@" 7530var statement = (DoStatementSyntax)SyntaxFactory.ParseStatement(@" 9636var statement = (LockStatementSyntax)SyntaxFactory.ParseStatement(@" 10199var statement = (YieldStatementSyntax)SyntaxFactory.ParseStatement(@" 10715var statement = (LabeledStatementSyntax)SyntaxFactory.ParseStatement(@" 12142var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"
Semantics\PrimaryConstructorTests.cs (2)
2164speculativeBaseInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, speculativePrimaryInitializer.ArgumentList); 2316speculativeBaseInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, speculativePrimaryInitializer.ArgumentList);
Semantics\RecordTests.cs (2)
22321speculativeBaseInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, speculativePrimaryInitializer.ArgumentList); 22473speculativeBaseInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, speculativePrimaryInitializer.ArgumentList);
Microsoft.CodeAnalysis.CSharp.Features (292)
AddImport\CSharpAddImportFeatureService.cs (1)
32using static SyntaxFactory;
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
119var annotatedNewline = SyntaxFactory.EndOfLine(options.FormattingOptions.NewLine).WithAdditionalAnnotations(s_closingBraceNewlineAnnotation);
ChangeSignature\CSharpChangeSignatureService.cs (1)
29using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ChangeSignature\UnifiedArgumentSyntax.cs (4)
54? Create(argument.WithNameColon(SyntaxFactory.NameColon(SyntaxFactory.IdentifierName(name)))) 55: Create(((AttributeArgumentSyntax)_argument).WithNameColon(SyntaxFactory.NameColon(SyntaxFactory.IdentifierName(name))));
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
26using static SyntaxFactory;
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
269return SyntaxFactory.Parameter(name.ToIdentifierToken())
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (5)
164var newLine = SyntaxFactory.EndOfLine(options.NewLine); 169var nullableDisableTrivia = SyntaxFactory.Trivia(SyntaxFactory.NullableDirectiveTrivia(DisableKeyword.WithPrependedLeadingTrivia(SyntaxFactory.ElasticSpace), isActive: true)); 180return root.ReplaceTrivia(leadingDirective.ParentTrivia, SyntaxFactory.ElasticMarker);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
348var newLabeledStatement = labeledStatement.ReplaceNode(newLocalDeclaration, SyntaxFactory.ParseStatement("")); 391return SyntaxFactory.ObjectCreationExpression(implicitCreation.NewKeyword, type, implicitCreation.ArgumentList, implicitCreation.Initializer); 409return SyntaxFactory.ArrayCreationExpression(arrayType, arrayInitializer);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs (2)
71SyntaxFactory.NameEquals(identifier), UpdateIdentifier(identifier)).WithTriviaFrom(node); 84SyntaxFactory.NameColon(identifier), node.RefKindKeyword, UpdateIdentifier(identifier)).WithTriviaFrom(node);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
27using static SyntaxFactory;
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (5)
29using static SyntaxFactory; 389return SyntaxFactory.Subpattern(ExpressionColon(expression, Token(ColonToken)), pattern); 401=> SyntaxFactory.Subpattern(NameColon(name), pattern); 404=> SyntaxFactory.RecursivePattern(type: null, positionalPatternClause: null, PropertyPatternClause([.. subpatterns]), designation: null); 407=> SyntaxFactory.RecursivePattern(type, positionalPatternClause: null, PropertyPatternClause([subpattern]), designation);
Completion\Providers\OutVariableArgumentProvider.cs (1)
14using static SyntaxFactory;
ConvertAnonymousType\CSharpConvertAnonymousTypeToClassCodeRefactoringProvider.cs (4)
37return SyntaxFactory.ObjectCreationExpression( 42=> SyntaxFactory.ArgumentList( 48=> SyntaxFactory.SeparatedList<ArgumentSyntax>(CreateArguments(OmitTrailingComma(initializers.GetWithSeparators()))); 77=> SyntaxFactory.Argument(decl.Expression);
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
18using static SyntaxFactory;
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (2)
106var blockSyntax = SyntaxFactory.Block( 107OpenBraceToken.WithLeadingTrivia(SyntaxFactory.ElasticCarriageReturnLineFeed),
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider.cs (2)
68var newStartToken = SyntaxFactory.Token( 80=> SyntaxFactory.Token(
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (1)
58=> SyntaxFactory.Token(
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (1)
20using static SyntaxFactory;
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (1)
121return SyntaxFactory.ForEachStatement(
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
19using static SyntaxFactory;
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (1)
22using static SyntaxFactory;
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (3)
181=> SyntaxFactory.InvocationExpression( 182SyntaxFactory.MemberAccessExpression( 185SyntaxFactory.IdentifierName(MethodName))).WithAdditionalAnnotations(Formatter.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (3)
238selectExpression: SyntaxFactory.IdentifierName(forEachInfo.ForEachStatement.Identifier), 347return compilationUnit.AddUsings(SyntaxFactory.UsingDirective(SyntaxFactory.ParseName("System.Linq")));
ConvertLinq\ConvertForEachToLinqQuery\DefaultConverter.cs (1)
19using static SyntaxFactory;
ConvertLinq\ConvertForEachToLinqQuery\ToCountConverter.cs (2)
42=> SyntaxFactory.ExpressionStatement( 43SyntaxFactory.AssignmentExpression(
ConvertLinq\ConvertForEachToLinqQuery\ToToListConverter.cs (6)
47=> SyntaxFactory.ExpressionStatement( 48SyntaxFactory.InvocationExpression( 49SyntaxFactory.MemberAccessExpression( 52SyntaxFactory.IdentifierName(nameof(List<object>.AddRange))), 53SyntaxFactory.ArgumentList([SyntaxFactory.Argument(queryOrLinqInvocationExpression)])));
ConvertLinq\ConvertForEachToLinqQuery\YieldReturnConverter.cs (1)
38SyntaxFactory.ReturnStatement(queryOrLinqInvocationExpression).WithAdditionalAnnotations(Formatter.Annotation));
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
28using static SyntaxFactory;
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
33using static SyntaxFactory;
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (1)
15using static SyntaxFactory;
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
22using static SyntaxFactory;
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
25using static SyntaxFactory;
ConvertToInterpolatedString\CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
31=> SyntaxFactory.ParseExpression(text);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
26using static SyntaxFactory;
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
21using static SyntaxFactory;
ConvertTupleToStruct\CSharpConvertTupleToStructCodeRefactoringProvider.cs (1)
45var newName = SyntaxFactory.IdentifierName(name).WithTriviaFrom(nameColon.Name);
Copilot\CSharpCopilotCodeFixProvider.cs (1)
108var memberDeclaration = SyntaxFactory.ParseMemberDeclaration(fix, options: method.SyntaxTree.Options);
Debugging\BreakpointResolver.cs (3)
50var name = SyntaxFactory.ParseName(text, consumeFullText: false); 52var parameterList = SyntaxFactory.ParseParameterList(text, lengthOfParsedText, consumeFullText: false); 72var token = SyntaxFactory.ParseToken(text, lengthOfParsedText);
Debugging\CSharpProximityExpressionsService.cs (1)
55var expression = SyntaxFactory.ParseExpression(expressionValue);
DecompiledSource\CSharpDecompiledSourceService.cs (13)
76var regionTrivia = SyntaxFactory.RegionDirectiveTrivia(true) 77.WithTrailingTrivia(new[] { SyntaxFactory.Space, SyntaxFactory.PreprocessingMessage(assemblyInfo) }); 84SyntaxFactory.Trivia(regionTrivia), 85SyntaxFactory.CarriageReturnLineFeed, 86SyntaxFactory.Comment("// " + assemblyPath), 87SyntaxFactory.CarriageReturnLineFeed, 88SyntaxFactory.Comment($"// Decompiled with ICSharpCode.Decompiler {decompilerVersion.FileVersion}"), 89SyntaxFactory.CarriageReturnLineFeed, 90SyntaxFactory.Trivia(SyntaxFactory.EndRegionDirectiveTrivia(true)), 91SyntaxFactory.CarriageReturnLineFeed, 92SyntaxFactory.CarriageReturnLineFeed
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
205if (SyntaxFactory.AreEquivalent(exceptionType, catchClause.Declaration.Type.ConvertToSingleLine()))
DocumentationComments\DocCommentConverter.cs (5)
61newLeadingTrivia.Add(SyntaxFactory.Comment("//")); 62newLeadingTrivia.Add(SyntaxFactory.ElasticCarriageReturnLineFeed); 91yield return SyntaxFactory.Comment("// " + line); 95yield return SyntaxFactory.Comment("//"); 98yield return SyntaxFactory.ElasticCarriageReturnLineFeed;
EditAndContinue\DeclarationBody\CSharpLambdaBody.cs (1)
64=> SyntaxFactory.AreEquivalent(node, ((CSharpLambdaBody)other).Node);
EditAndContinue\SyntaxComparer.cs (10)
728if (!SyntaxFactory.AreEquivalent(leftBody, rightBody, null)) 756return SyntaxFactory.AreEquivalent(left, right, ignoreChildFunction); 761return SyntaxFactory.AreEquivalent(left.Labels, right.Labels, null) 762&& SyntaxFactory.AreEquivalent(left.Statements, right.Statements, ignoreChildNode: HasLabel); 1517if (weightedDistance == ExactMatchDist && !SyntaxFactory.AreEquivalent(oldNode, newNode)) 1530if (SyntaxFactory.AreEquivalent(oldNode, newNode)) 1553Debug.Assert(!SyntaxFactory.AreEquivalent(leftToken, rightToken) || distance == ExactMatchDist); 1561Debug.Assert(!SyntaxFactory.AreEquivalent(leftNode, rightNode) || distance == ExactMatchDist); 1659=> SyntaxFactory.AreEquivalent(oldElement, newElement); 1667=> SyntaxFactory.AreEquivalent(oldElement, newElement);
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (1)
118var testFileTree = SyntaxFactory.ParseSyntaxTree(testFileSourceText, semanticModel.SyntaxTree.Options, cancellationToken: cancellationToken);
EmbeddedLanguages\EmbeddedLanguageUtilities.cs (3)
14var triviaList = SyntaxFactory.TriviaList( 15SyntaxFactory.Comment($"/*{commentContents}*/"), 16SyntaxFactory.ElasticSpace);
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
29using static SyntaxFactory;
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (1)
39var info = model.GetSpeculativeTypeInfo(SelectionResult.FinalSpan.Start, SyntaxFactory.ParseName(symbol.Name), SpeculativeBindingOption.BindAsExpression);
ExtractMethod\CSharpMethodExtractor.cs (3)
170=> SyntaxFactory.ParseTypeName(name); 185methodDefinition = methodDefinition.WithPrependedLeadingTrivia(SyntaxFactory.EndOfLine(newLine)); 190methodDefinition = methodDefinition.WithPrependedLeadingTrivia(SyntaxFactory.EndOfLine(newLine));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (7)
103return SyntaxFactory.EmptyStatement(SyntaxFactory.Token([.. triviaList], SyntaxKind.SemicolonToken, [SyntaxFactory.ElasticMarker])); 117SyntaxFactory.LocalDeclarationStatement( 119SyntaxFactory.VariableDeclaration( 290return SyntaxFactory.Block(statements); 340_statementsOrMemberOrAccessorToInsert.Select(s => global ? SyntaxFactory.GlobalStatement((StatementSyntax)s) : (MemberDeclarationSyntax)s));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
34using static SyntaxFactory; 192return [.. AnalyzerResult.MethodTypeParametersInDeclaration.Select(m => SyntaxFactory.ParseTypeName(m.Name))];
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (5)
40return SyntaxFactory.Identifier(nameGenerator.CreateUniqueMethodName(containingScope, methodName)); 100expression = SyntaxFactory.ArrayCreationExpression(typeSyntax as ArrayTypeSyntax, containingScope as InitializerExpressionSyntax); 109return [SyntaxFactory.ReturnStatement( 114return [SyntaxFactory.ExpressionStatement( 127return SyntaxFactory.CheckedExpression(kind, expression);
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
17using static SyntaxFactory;
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (2)
105return location == TriviaLocation.AfterBeginningOfSpan ? [SyntaxFactory.ElasticMarker] : []; 113return location == TriviaLocation.AfterBeginningOfSpan ? [SyntaxFactory.ElasticMarker] : [];
FullyQualify\CSharpFullyQualifyService.cs (2)
48var qualifiedName = SyntaxFactory.QualifiedName(SyntaxFactory.ParseName(containerName), newName)
GenerateEqualsAndGetHashCodeFromMembers\CSharpGenerateEqualsAndGetHashCodeService.cs (2)
27wrappedStatements = [SyntaxFactory.CheckedStatement(SyntaxKind.UncheckedStatement, 28SyntaxFactory.Block(statements.OfType<StatementSyntax>()))];
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
21using static SyntaxFactory;
GenerateType\CSharpGenerateTypeService.cs (2)
735var usingDirective = SyntaxFactory.UsingDirective(SyntaxFactory.ParseName(includeUsingsOrImports));
InitializeParameter\CSharpAddParameterCheckCodeRefactoringProvider.cs (1)
16using static SyntaxFactory;
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
31using static SyntaxFactory;
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
18using static SyntaxFactory;
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
26using static SyntaxFactory;
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (1)
12using static SyntaxFactory;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (1)
20using static SyntaxFactory;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
25using static SyntaxFactory;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceQueryLocal.cs (2)
34var newLocalName = SyntaxFactory.IdentifierName(newLocalNameToken); 36var letClause = SyntaxFactory.LetClause(
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (1)
22using static SyntaxFactory;
MetadataAsSource\CSharpMetadataAsSourceService.cs (1)
26using static SyntaxFactory;
NameTupleElement\CSharpNameTupleElementCodeRefactoringProvider.cs (1)
27=> argument.WithNameColon(SyntaxFactory.NameColon(argumentName.ToIdentifierName()));
ReplaceDocCommentTextWithTag\CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
33=> SyntaxFactory.ParseExpression(text);
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (1)
25using static SyntaxFactory;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.ConvertValueToParamRewriter.cs (2)
22=> name.ReplaceToken(name.LocalName, SyntaxFactory.Identifier("param")); 30.AddAttributes(SyntaxFactory.XmlNameAttribute("value"));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.ConvertValueToReturnsRewriter.cs (1)
22=> name.ReplaceToken(name.LocalName, SyntaxFactory.Identifier("returns"));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
27using static SyntaxFactory;
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
24using static SyntaxFactory;
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
26using static SyntaxFactory;
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (2)
66return SyntaxFactory.PropertyDeclaration( 72accessorList: SyntaxFactory.AccessorList([.. (IEnumerable<AccessorDeclarationSyntax>)accessors.Where(a => a is not null)]));
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
26using static SyntaxFactory;
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
104typeDeclaration.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpDoWhileLoopSnippetProvider.cs (2)
35return SyntaxFactory.DoStatement( 36SyntaxFactory.Block(),
Snippets\CSharpElseSnippetProvider.cs (2)
59var elseClause = SyntaxFactory.ElseClause(SyntaxFactory.Block());
Snippets\CSharpForEachLoopSnippetProvider.cs (1)
27using static SyntaxFactory;
Snippets\CSharpIntMainSnippetProvider.cs (1)
60var updatedReturnStatement = returnStatement.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString));
Snippets\CSharpPropiSnippetProvider.cs (1)
29=> SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration).WithSemicolonToken(SemicolonToken);
Snippets\CSharpSnippetHelpers.cs (1)
55var updatedBlock = block.WithCloseBraceToken(block.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpVoidMainSnippetProvider.cs (1)
31=> SyntaxFactory.PredefinedType(VoidKeyword);
SpellCheck\CSharpSpellcheckCodeFixProvider.cs (1)
69=> SyntaxFactory.Identifier(newName).WithTriviaFrom(nameToken);
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (1)
18using static SyntaxFactory;
SplitStringLiteral\InterpolatedStringSplitter.cs (1)
17using static SyntaxFactory;
SplitStringLiteral\SimpleStringSplitter.cs (6)
50var firstToken = SyntaxFactory.Token( 55trailing: [SyntaxFactory.ElasticSpace]); 57var secondToken = SyntaxFactory.Token( 64var leftExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, firstToken); 65var rightExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, secondToken); 67return SyntaxFactory.BinaryExpression(
SplitStringLiteral\StringSplitter.cs (3)
26protected readonly SyntaxToken PlusNewLineToken = SyntaxFactory.Token( 29[SyntaxFactory.EndOfLine( 116var newRightExpression = rightExpression.WithLeadingTrivia(SyntaxFactory.ElasticWhitespace(indentString));
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
256if (!SyntaxFactory.AreEquivalent(node.Left, _assignmentTargetOpt))
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
149if (SyntaxFactory.AreEquivalent(expression, invocationExpression.Expression, topLevel: false)) 154SyntaxFactory.AreEquivalent(expression, memberAccessExpression.Expression, topLevel: false))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
27using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
16using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
12using static SyntaxFactory;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
201if (!SyntaxFactory.AreEquivalent(isExpression.Left.WalkDownParentheses(), castExpression.Expression.WalkDownParentheses(), topLevel: false) || 202!SyntaxFactory.AreEquivalent(isExpression.Right.WalkDownParentheses(), castExpression.Type, topLevel: false))
src\Analyzers\CSharp\CodeFixes\AddAnonymousTypeMemberName\CSharpAddAnonymousTypeMemberNameCodeFixProvider.cs (2)
38SyntaxFactory.NameEquals( 39SyntaxFactory.IdentifierName(name)));
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
47return embeddedStatement is null ? currentStatement : currentStatement.ReplaceNode(embeddedStatement, SyntaxFactory.Block(embeddedStatement));
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (2)
59var newBody = SyntaxFactory.Block(statements.Add(exprOrStatement).Cast<StatementSyntax>()); 79var newBody = SyntaxFactory.Block(statements.Add(generator.ReturnStatement(exprOrStatement)).Cast<StatementSyntax>());
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
18using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
98SyntaxFactory.ParseTypeName("Task")
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
412return SyntaxFactory.LiteralExpression(
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (4)
75var newDocCommentNode = SyntaxFactory.DocumentationComment(SyntaxFactory.XmlParamElement(parameterName)); 81return elementNode.WithTrailingTrivia(SyntaxFactory.ParseTrailingTrivia(Environment.NewLine)); 85SyntaxFactory.ParseLeadingTrivia(Environment.NewLine)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
41=> SyntaxFactory.ParseLeadingTrivia(docCommentText);
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
105clause.Constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
65identifierToken = SyntaxFactory.Token( 91identifierToken = SyntaxFactory.Token(
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
103var methodDecl = SyntaxFactory.DestructorDeclaration(classType.Name).AddBodyStatements(disposeStatement);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
28using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
74var yieldStatement = SyntaxFactory.YieldStatement(
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (1)
64newReturnType = SyntaxFactory.PredefinedType(VoidKeyword).WithTriviaFrom(returnTypeSyntax);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
366var newFirstMember = firstMember.WithLeadingTrivia(firstMemberTrivia.Insert(0, SyntaxFactory.CarriageReturnLineFeed));
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
78.WithTrailingTrivia(SyntaxFactory.Space); 97replacementMap[colonToken] = colonToken.WithLeadingTrivia(thisBaseKeyword.LeadingTrivia).WithTrailingTrivia(SyntaxFactory.Space);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
106var fixedDeclaration = SyntaxFactory.NullableType(declarationTypeToFix.WithoutTrivia()).WithTriviaFrom(declarationTypeToFix);
src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
16using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
38var block = SyntaxFactory.Block(statement);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (2)
53return SyntaxFactory.BinaryExpression( 66SyntaxFactory.TypePattern(((DeclarationPatternSyntax)current).Type)
src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (1)
87editor.ReplaceNode(statement, SyntaxFactory.Block());
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (1)
19using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (3)
59var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1)); 65.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil))) 69.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
32using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
22using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (4)
23=> SyntaxFactory.Token(kind); 28return SyntaxFactory.AssignmentExpression(assignmentOpKind, left, syntaxToken, right); 42=> SyntaxFactory.PostfixUnaryExpression(kind, operand); 45=> SyntaxFactory.PrefixUnaryExpression(kind, operand);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
35=> variable.WithInitializer(SyntaxFactory.EqualsValueClause(value));
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionHelpers.cs (1)
17return SyntaxFactory.ThrowExpression(throwStatement.ThrowKeyword, throwStatement.Expression);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
60SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
18using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
25using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
50var implicitType = SyntaxFactory.IdentifierName("var")
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
16=> SyntaxFactory.PrefixUnaryExpression(
src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
57var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
15using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
18using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
30using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
56=> SyntaxFactory.ElementBindingExpression(argumentList);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (2)
21using static SyntaxFactory; 47=> SyntaxFactory.Whitespace(text);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
12using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
26using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (5)
61var updatedCondition = SyntaxFactory.IsPatternExpression( 62isExpression.Left, SyntaxFactory.DeclarationPattern( 64SyntaxFactory.SingleVariableDesignation( 69.SelectMany(t => ImmutableArray.Create(SyntaxFactory.Space, t, SyntaxFactory.ElasticCarriageReturnLineFeed))
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
33using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
24using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
29using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
20using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
21using static SyntaxFactory;
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
23using static SyntaxFactory;
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (2)
243if (!SyntaxFactory.AreEquivalent(sourceIdentifier, selectorIdentifier)) 366return oldTokens.SequenceEqual(newTokens, SyntaxFactory.AreEquivalent);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
28using static SyntaxFactory;
UseAutoProperty\UseAutoPropertyRewriter.cs (1)
10using static SyntaxFactory;
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (1)
17using static SyntaxFactory;
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (7)
175if (SyntaxFactory.AreEquivalent(castExpression.Type, type) && 220var newLocalName = SyntaxFactory.Identifier(localName) 222var isPattern = SyntaxFactory.IsPatternExpression( 224SyntaxFactory.DeclarationPattern((TypeSyntax)isExpression.Right.WithTrailingTrivia(SyntaxFactory.Space), 225SyntaxFactory.SingleVariableDesignation(newLocalName))).WithTriviaFrom(isExpression); 230var localReference = SyntaxFactory.IdentifierName(localName);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (21)
EditAndContinue\BreakpointSpansTests.cs (2)
39var tree = SyntaxFactory.ParseSyntaxTree(source, options); 75var tree = SyntaxFactory.ParseSyntaxTree(source);
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
50var tree = SyntaxFactory.ParseSyntaxTree(source); 457var root = SyntaxFactory.ParseCompilationUnit(source, options: experimental);
EditAndContinue\Helpers\EditingTestBase.cs (4)
130=> SyntaxFactory.ParseSyntaxTree( 219? ((BaseMethodDeclarationSyntax)SyntaxFactory.SyntaxTree(declaration).GetRoot()).Body 220: (BlockSyntax)SyntaxFactory.SyntaxTree(declaration.Body!).GetRoot(); 235=> new(oldSource, newSource, source => SyntaxFactory.ParseSyntaxTree(source, path: GetDocumentFilePath(documentIndex)), flags);
EditAndContinue\SyntaxComparerTests.cs (4)
23=> SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(n)); 112var distance = SyntaxComparer.ComputeDistance(SyntaxFactory.Literal("abc", "abc"), SyntaxFactory.Literal("acb", "acb"));
EditAndContinue\SyntaxUtilitiesTests.cs (9)
21var oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).GetRoot(); 22var newRoot = SyntaxFactory.ParseSyntaxTree(newSource).GetRoot(); 27Assert.True(SyntaxFactory.AreEquivalent(oldNode, newNode), $"Node '{oldNode}' not equivalent to '{newNode}'."); 73var leftRoot = SyntaxFactory.ParseSyntaxTree(@" 88var rightRoot = SyntaxFactory.ParseSyntaxTree(@" 116var leftRoot = SyntaxFactory.ParseSyntaxTree(@" 135var rightRoot = SyntaxFactory.ParseSyntaxTree(@" 164var tree = SyntaxFactory.ParseSyntaxTree(@" 225var tree = SyntaxFactory.ParseSyntaxTree(@"
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (14)
IOperation\IOperationTests.cs (1)
608var speculatedBlock = (BlockSyntax)SyntaxFactory.ParseStatement(@"
IOperation\IOperationTests_IVariableDeclaration.cs (13)
1217.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(10))))); 2303.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }")))); 2364.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }")))); 2832.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }"))));
Microsoft.CodeAnalysis.CSharp.Scripting (3)
CSharpScriptCompiler.cs (3)
28public override bool IsCompleteSubmission(SyntaxTree tree) => SyntaxFactory.IsCompleteSubmission(tree); 31=> SyntaxFactory.ParseSyntaxTree(text, parseOptions ?? DefaultParseOptions, cancellationToken: cancellationToken); 47var tree = SyntaxFactory.ParseSyntaxTree(script.SourceText, script.Options.ParseOptions ?? DefaultParseOptions, script.Options.FilePath);
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (2)
InteractiveSessionReferencesTests.cs (2)
528new[] { SyntaxFactory.ParseSyntaxTree("public class C {}") }, 1116new[] { SyntaxFactory.ParseSyntaxTree(source) },
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (176)
Semantics\BindingAsyncTests.cs (3)
53var tree = SyntaxFactory.ParseSyntaxTree(source); 82var tree = SyntaxFactory.ParseSyntaxTree(source); 3163syntaxTree: SyntaxFactory.ParseSyntaxTree(source0, options: TestOptions.Script),
Semantics\BindingAwaitTests.cs (1)
26var tree = SyntaxFactory.ParseSyntaxTree(" class C { void M() { await X() on ");
Semantics\ConstantTests.cs (3)
2907var tree = SyntaxFactory.ParseSyntaxTree(@" 2934var tree = SyntaxFactory.ParseSyntaxTree(@" 2962var tree = SyntaxFactory.ParseSyntaxTree(@"
Semantics\DelegateTypeTests.cs (1)
12119var stmt = SyntaxFactory.ParseStatement(text);
Semantics\GlobalUsingDirectiveTests.cs (1)
4975var alias1 = SyntaxFactory.IdentifierName("alias1");
Semantics\ImplicitObjectCreationTests.cs (2)
4160var newExpression = SyntaxFactory.ParseExpression("new()"); 4187var modifiedNode = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("M(new());", options: ImplicitObjectCreationTestOptions);
Semantics\InitOnlyMemberTests.cs (1)
3128var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"
Semantics\InteractiveUsingTests.cs (2)
586SyntaxFactory.IdentifierName(name), 596SyntaxFactory.IdentifierName(name),
Semantics\InterpolationTests.cs (12)
533Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 534Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 535Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 536Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 537Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 538Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 539Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 540Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 558Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 576Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 595Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 1489Assert.True(SyntaxFactory.ParseSyntaxTree(text).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
Semantics\LambdaTests.cs (10)
837var tree = SyntaxFactory.ParseSyntaxTree(source); 946SyntaxFactory.ParseExpression("Goo(() => () => { var x = null; return x; })"), // cast removed 1169var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular9); 1202var tree = SyntaxFactory.ParseSyntaxTree(source); 1234var tree = SyntaxFactory.ParseSyntaxTree(source); 2994var tree = SyntaxFactory.ParseSyntaxTree(source); 3036var tree = SyntaxFactory.ParseSyntaxTree(source); 3985var newTree = SyntaxFactory.ParseSyntaxTree(source + " "); 8084var newStmt = SyntaxFactory.ParseStatement("var lam = (int b = M1(4)) => b;"); 8085var newMethod = m2Syntax.WithBody(SyntaxFactory.Block(newStmt));
Semantics\LocalFunctionTests.cs (17)
343var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular9); 347var newTree = SyntaxFactory.ParseSyntaxTree(text + " "); 391var tree = SyntaxFactory.ParseSyntaxTree(text); 403var newTree = SyntaxFactory.ParseSyntaxTree(text + " "); 438var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular9); 443var newTree = SyntaxFactory.ParseSyntaxTree(text + " ", options: TestOptions.Regular9); 1679var tree = SyntaxFactory.ParseSyntaxTree(@" 1889var tree = SyntaxFactory.ParseSyntaxTree(@" 1945var tree = SyntaxFactory.ParseSyntaxTree(@" 7360=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7455=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7458=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 7532=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7585=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 8941=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9445=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9763=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\LookupTests.cs (1)
1505var node2 = (ExpressionSyntax)SyntaxFactory.SyntaxTree(node).GetRoot();
Semantics\NameOfTests.cs (4)
975var tree2 = SyntaxFactory.ParseSyntaxTree(source + " "); 1047var tree2 = SyntaxFactory.ParseSyntaxTree(source + " "); 1129var tree2 = SyntaxFactory.ParseSyntaxTree(source + " "); 1210var tree2 = SyntaxFactory.ParseSyntaxTree(source + " ");
Semantics\NativeIntegerTests.cs (1)
4075var typeSyntax = SyntaxFactory.ParseTypeName("nuint");
Semantics\NullableContextTests.cs (1)
2229var type = SyntaxFactory.ParseTypeName(typeName);
Semantics\NullableReferenceTypesTests.cs (20)
5792var source4 = SyntaxFactory.ParseSyntaxTree(@" 7774SyntaxFactory.SeparatedList<ExpressionSyntax>( 7775new[] { SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(3)) }), 113787TypeSyntax type = SyntaxFactory.ParseTypeName( 113824TypeSyntax type = SyntaxFactory.ParseTypeName( 113849TypeSyntax type = SyntaxFactory.ParseTypeName( 113874TypeSyntax type = SyntaxFactory.ParseTypeName( 113903TypeSyntax type = SyntaxFactory.ParseTypeName( 113930TypeSyntax type = SyntaxFactory.ParseTypeName( 113958TypeSyntax type = SyntaxFactory.ParseTypeName( 113986TypeSyntax type = SyntaxFactory.ParseTypeName( 114012TypeSyntax type = SyntaxFactory.ParseTypeName( 114050TypeSyntax type = SyntaxFactory.ParseTypeName( 114075TypeSyntax type = SyntaxFactory.ParseTypeName( 114100TypeSyntax type = SyntaxFactory.ParseTypeName( 114129TypeSyntax type = SyntaxFactory.ParseTypeName( 114156TypeSyntax type = SyntaxFactory.ParseTypeName( 114184TypeSyntax type = SyntaxFactory.ParseTypeName( 114212TypeSyntax type = SyntaxFactory.ParseTypeName(
Semantics\QueryTests.cs (6)
2300var info = semanticModel.GetSpeculativeTypeInfo(selectExpression.SpanStart, SyntaxFactory.ParseExpression("x"), SpeculativeBindingOption.BindAsExpression); 3414var queryStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(speculatedSource); 3458var queryStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(speculatedSource); 3505var queryStatement = SyntaxFactory.ParseStatement(speculatedSource); 3544var queryStatement = SyntaxFactory.ParseStatement(speculatedSource); 3588var queryStatement = SyntaxFactory.ParseStatement(speculatedSource);
Semantics\RawInterpolationTests.cs (8)
559Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 560Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 561Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 562Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 580Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 598Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 617Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 1163Assert.True(SyntaxFactory.ParseSyntaxTree(text).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
Semantics\RecordStructTests.cs (1)
10651AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, SyntaxFactory.TypeDeclaration(SyntaxKind.RecordStructDeclaration, "Point").NormalizeWhitespace().ToString());
Semantics\RefEscapingTests.cs (18)
23var tree = SyntaxFactory.ParseSyntaxTree(@" 2612var tree = SyntaxFactory.ParseSyntaxTree(""" 2647var tree = SyntaxFactory.ParseSyntaxTree(""" 2676var tree = SyntaxFactory.ParseSyntaxTree(""" 2871var tree = SyntaxFactory.ParseSyntaxTree(""" 2928var tree = SyntaxFactory.ParseSyntaxTree(""" 2968var tree = SyntaxFactory.ParseSyntaxTree(""" 3178var tree = SyntaxFactory.ParseSyntaxTree(""" 3206var tree = SyntaxFactory.ParseSyntaxTree(""" 3288var tree = SyntaxFactory.ParseSyntaxTree(""" 3375var tree = SyntaxFactory.ParseSyntaxTree(""" 3752var tree = SyntaxFactory.ParseSyntaxTree(""" 3797var tree = SyntaxFactory.ParseSyntaxTree(""" 3900var tree = SyntaxFactory.ParseSyntaxTree(""" 4135var tree = SyntaxFactory.ParseSyntaxTree(""" 6782var tree = SyntaxFactory.ParseSyntaxTree(""" 10254var tree = SyntaxFactory.ParseSyntaxTree(""" 10290var tree = SyntaxFactory.ParseSyntaxTree("""
Semantics\RefLocalsAndReturnsTests.cs (2)
539var tree = SyntaxFactory.ParseSyntaxTree(@" 1083var tree = SyntaxFactory.ParseSyntaxTree(@"
Semantics\ScriptSemanticsTests.cs (18)
263var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script); 286var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script); 298var submission = CSharpCompilation.CreateScriptCompilation("test", syntaxTree: SyntaxFactory.ParseSyntaxTree("1", options: TestOptions.Script), returnType: typeof(int)); 365var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 396var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 443var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script); 485var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script.WithLanguageVersion(LanguageVersion.CSharp6)); 1179var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1207syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1216syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1225syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1237syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1249syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1267var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit("\nSystem.Console.WriteLine(1);", options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1269var syntaxTree2 = SyntaxFactory.ParseSyntaxTree("System.Console.WriteLine(2);", options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1306var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1336syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1351syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script));
Semantics\SemanticErrorTests.cs (1)
1385new[] { SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script) });
Semantics\SuppressAccessibilityChecksTests.cs (6)
75var exp = SyntaxFactory.ParseExpression("new A().M()._num"); 91var statement = SyntaxFactory.ParseStatement("var goo = new A().M();"); 119var tree = SyntaxFactory.ParseSyntaxTree(source); 126SyntaxFactory.ParseExpression("a._p"), 174var speculativeInvocation = SyntaxFactory.ParseExpression("new A().InternalExtension(67)"); 203var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"
Semantics\SwitchTests.cs (2)
1147var syntaxTree = SyntaxFactory.ParseSyntaxTree(source); 2419syntaxTree: SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Script),
Semantics\SyntaxTreeRootTests.cs (29)
26var node = SyntaxFactory.UsingDirective(SyntaxFactory.IdentifierName("Blah")); 27var tree = SyntaxFactory.SyntaxTree(node); 34var node = SyntaxFactory.CatchClause(SyntaxFactory.CatchDeclaration(SyntaxFactory.ParseTypeName(typeof(InvalidOperationException).Name)), null, SyntaxFactory.Block()); 42var tree = SyntaxFactory.ParseSyntaxTree(@"class Program { static void Main() { System.Console.WriteLine(""Wah""); } }"); 50var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.FromClause("Nay", SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(823)))); 60var arbitraryTree = SyntaxFactory.SyntaxTree(SyntaxFactory.Attribute(SyntaxFactory.IdentifierName("Wooh"))); 61var parsedTree = SyntaxFactory.ParseSyntaxTree(""); 71var tree = SyntaxFactory.SyntaxTree( 72SyntaxFactory.LetClause("Blah", SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(54))), 74SyntaxFactory.IsCompleteSubmission(tree); 80var node = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(3)); 88var node = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(3)); 96var node = SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, 97SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(3))); 107var tree = SyntaxFactory.ParseSyntaxTree("class TheClass { }");
Semantics\TargetTypedDefaultTests.cs (1)
2484var expressionSyntax = SyntaxFactory.ParseExpression("default");
Semantics\TopLevelStatementsTests.cs (1)
9704var nodeToSpeculate = SyntaxFactory.ParseStatement("int y = x;");
Semantics\UnsafeTests.cs (3)
6270var tree = SyntaxFactory.ParseSyntaxTree(@" 6366var tree = SyntaxFactory.ParseSyntaxTree(code, TestOptions.Regular); 7297model.GetSpeculativeTypeInfo(syntax.SpanStart, SyntaxFactory.ParseTypeName("S*"), SpeculativeBindingOption.BindAsTypeOrNamespace);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (357)
Compilation\CompilationAPITests.cs (48)
47var tree = SyntaxFactory.ParseSyntaxTree(@" 70var tree = SyntaxFactory.ParseSyntaxTree("class C { long _f = 0l;}"); 90var tree = SyntaxFactory.ParseSyntaxTree("class C { long _f = 0l;}"); 112var tree = SyntaxFactory.ParseSyntaxTree(@" 138var tree = SyntaxFactory.ParseSyntaxTree("class C { long _f = 0l; }"); 165var tree = SyntaxFactory.ParseSyntaxTree(@" class C { long _f = 0l; }"); 166var newTree = SyntaxFactory.ParseSyntaxTree(@" class D { long _f = 0l; }"); 191var tree = SyntaxFactory.ParseSyntaxTree(@" class C { long _f = 0l; }"); 353SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree(s1); 386new[] { SyntaxFactory.ParseSyntaxTree("class C { static void Main() {} }") }, 614syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree("public class C {}") }, 622syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 633syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 646syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 682syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree("public class C {}", options: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp6)) }, 690syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 701syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 714syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree( 783SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree(s1); 784SyntaxTree withErrorTree = SyntaxFactory.ParseSyntaxTree(s2); 785SyntaxTree withErrorTree1 = SyntaxFactory.ParseSyntaxTree(s3); 786SyntaxTree withErrorTreeVB = SyntaxFactory.ParseSyntaxTree(s4); 787SyntaxTree withExpressionRootTree = SyntaxFactory.ParseExpression(s3).SyntaxTree; 788var withWarning = SyntaxFactory.ParseSyntaxTree(s5); 791var comp = CSharpCompilation.Create("Compilation", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(s1) }, options: TestOptions.ReleaseDll); 805Assert.False(comp.SyntaxTrees.Contains(SyntaxFactory.ParseSyntaxTree(s1))); 807comp = comp.AddSyntaxTrees(SyntaxFactory.ParseSyntaxTree(s1)); 811comp = comp.ReplaceSyntaxTree(t1, SyntaxFactory.ParseSyntaxTree(s1)); 825Assert.Throws<ArgumentException>(() => comp = comp.RemoveSyntaxTrees(SyntaxFactory.ParseSyntaxTree(s1))); 840SyntaxTree t4 = SyntaxFactory.ParseSyntaxTree("Using System;"); 841SyntaxTree t5 = SyntaxFactory.ParseSyntaxTree("Usingsssssssssssss System;"); 842SyntaxTree t6 = SyntaxFactory.ParseSyntaxTree("Import System;"); 929SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree(s1); 930SyntaxTree t2 = SyntaxFactory.ParseSyntaxTree(s2); 931SyntaxTree t3 = SyntaxFactory.ParseSyntaxTree(s3); 1177var comp1 = CSharpCompilation.Create("Test1", new[] { SyntaxFactory.ParseSyntaxTree(text1) }); 1178var comp2 = CSharpCompilation.Create("Test2", new[] { SyntaxFactory.ParseSyntaxTree(text1) }); 1191new[] { SyntaxFactory.ParseSyntaxTree(text1) }, 1481SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree("Using System;"); 1489Assert.Throws<ArgumentException>(() => comp.ReplaceSyntaxTree(newTree: SyntaxFactory.ParseSyntaxTree("Using System;"), oldTree: t1)); 1541SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree("Using System;"); 1545comp = comp.ReplaceSyntaxTree(newTree: SyntaxFactory.ParseSyntaxTree("Using System;"), oldTree: t1); 1555SyntaxTree t1 = SyntaxFactory.ParseSyntaxTree("Using System;"); 1564SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("Using Goo;"); 1619SyntaxTree t4 = SyntaxFactory.ParseSyntaxTree(s1); 2379var tree1 = SyntaxFactory.ParseSyntaxTree("", CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6)); 2380var tree2 = SyntaxFactory.ParseSyntaxTree("", CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6)); 2381var tree3 = SyntaxFactory.ParseSyntaxTree("", CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5));
Compilation\GetSemanticInfoTests.cs (8)
3786var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. 3819var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. 3913var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. 3953var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. 4066var speculativeSyntax = SyntaxFactory.ParseExpression("fields.Any((field => field.IsStatic))"); //cast removed 4322var speculativeSyntax = SyntaxFactory.ParseExpression("new List { 1, 2 }"); 4876var newSyntax = SyntaxFactory.ParseExpression("Instance.GetList().OfType<D>().Any()"); 6012var syntax = SyntaxFactory.ParseExpression("base");
Compilation\GetUnusedImportDirectivesTests.cs (1)
195var info = model.GetSpeculativeSymbolInfo(position, SyntaxFactory.IdentifierName("Console"), SpeculativeBindingOption.BindAsTypeOrNamespace);
Compilation\ReferenceManagerTests.cs (1)
1019new[] { SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular) },
Compilation\SemanticModelAPITests.cs (72)
729TypeSyntax speculate = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("A")); 1363var newSyntax = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer); 1392var newSyntax = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer); 1420var equalsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression(@"(string)""Hello""")); 1462var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1510var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1557var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("E.B | E.A")); 1598var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1679var newExpressionBody = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(@"(string)""Hello""")); 1766var statement = (BlockSyntax)SyntaxFactory.ParseStatement(@" 1832var statement = SyntaxFactory.ParseStatement(@"int z = 0;"); 1847statement = SyntaxFactory.ParseStatement(@"string y = null;"); 1873var labeledStatement = SyntaxFactory.ParseStatement(@"label: y++;"); 1905var switchStatement = (SwitchStatementSyntax)SyntaxFactory.ParseStatement(@" 1949var speculatedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"Func<int, int> var = (z) => x + z;"); 1982var statement = (ForEachStatementSyntax)SyntaxFactory.ParseStatement(@" 2029var newSyntax = SyntaxFactory.EqualsValueClause( 2030SyntaxFactory.ParseExpression("this.y")); 2074var newSyntax = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer); 2091var newArgument = SyntaxFactory.ParseExpression("1"); 2108newArgument = SyntaxFactory.ParseExpression("(string) 1"); 2143var newSyntax = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer); 2191var speculatedStatement = statement.ReplaceNode(initializer.Value, SyntaxFactory.ParseExpression("0")); 2225var speculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("0")); 2233var newSpeculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("1.1")); 2238newSpeculatedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"int z = 0;"); 2261var unsafeStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement("int *p = &x;"); 2317var speculativeSyntax = SyntaxFactory.ParseStatement("return default(C);"); 2338var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@" 2433var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@" 2475var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@" 2520var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@" 2566var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ int z = 0; }"); 2583blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ string y = null; }"); 2597blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ var y = x; }"); 2637var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ label: y++; }"); 2674var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ Func<int, int> var = (z) => x + z; }"); 2765var blockStatement = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ 2800var speculatedUsingExpression = SyntaxFactory.ParseName("System.Collections"); 2815var speculatedUsingExpression = SyntaxFactory.ParseName("System.ArgumentException"); 2835var speculatedTypeExpression = SyntaxFactory.ParseName("System.ArgumentException"); 2866var speculatedTypeExpression = SyntaxFactory.ParseName("System.ArgumentException"); 2895var speculatedAliasName = SyntaxFactory.ParseName("A"); 2928var speculatedCref = (TypeCrefSyntax)SyntaxFactory.ParseCref("object"); 2968var speculatedCref = (NameMemberCrefSyntax)SyntaxFactory.ParseCref("A"); 3013var speculatedCref = (QualifiedCrefSyntax)SyntaxFactory.ParseCref("A.B"); 3043speculatedCref = (QualifiedCrefSyntax)SyntaxFactory.ParseCref("A.M"); 3090var speculatedCref = (TypeCrefSyntax)SyntaxFactory.ParseCref("object"); 3158var yieldStatement = (YieldStatementSyntax)SyntaxFactory.ParseStatement("yield return 1;"); 3193var yieldStatement = (YieldStatementSyntax)SyntaxFactory.ParseStatement("yield return 1;"); 3223var typeSyntax = SyntaxFactory.ParseTypeName("System.Collections.Generic.IEnumerable<C[]>"); 3264var statementSyntax = SyntaxFactory.ParseStatement("TakesOut(out int x);"); 3305var statementSyntax = SyntaxFactory.ParseStatement("TakesOut(out int x);"); 3346var statementSyntax = SyntaxFactory.ParseExpression("TakesOut(out int x)"); 3380var statementSyntax = SyntaxFactory.ParseStatement("{ TakesOut(out int x); }"); 3422var statementSyntax = SyntaxFactory.ParseStatement("Method(o is string s);"); 3463var statementSyntax = SyntaxFactory.ParseStatement("Method(o is string s);"); 3504var statementSyntax = SyntaxFactory.ParseExpression("Method(o is string s)"); 3557return SyntaxFactory.ParseCompilationUnit(source + " class X {}").Members.First().AsTypeDeclarationSyntax().AttributeLists.First().Attributes.First(); 3585var attributeSyntax = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName("Category")); 3620var speculatedName = (GenericNameSyntax)SyntaxFactory.GenericName("List{T}"); 3788var @return = (ReturnStatementSyntax)SyntaxFactory.ParseStatement("return s;"); 4328var typeSyntax = SyntaxFactory.ParseTypeName("dynamic"); 4428var replacementIfStatement = (IfStatementSyntax)SyntaxFactory.ParseStatement(replacementSource);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (16)
2750var tree = SyntaxFactory.ParseSyntaxTree(test, options: new CSharpParseOptions(languageVersion: LanguageVersion.CSharp6)); 3104new[] { SyntaxFactory.ParseSyntaxTree(text2) }, 3959var tree2 = SyntaxFactory.ParseSyntaxTree(@" 4006symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<T>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4012symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<int>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4018symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4024symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("B<U>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4030symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("B<int>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4036symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("B<>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4042symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<>.B<>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4048symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<>.B<U>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4053symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<T>.B<>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4059symbolInfo = model.GetSpeculativeSymbolInfo(typeofArgPosition, SyntaxFactory.ParseTypeName("A<T>.B<U>"), SpeculativeBindingOption.BindAsTypeOrNamespace); 4089var expression = SyntaxFactory.ParseExpression("B"); 4106return SyntaxFactory.ParseCompilationUnit(source + " class X {}").Members.First().AsTypeDeclarationSyntax().AttributeLists.First().Attributes.First(); 4369var attr8 = SyntaxFactory.ParseCompilationUnit(@"[assembly: O(""hello"")]").AttributeLists.First().Attributes.First();
DeclarationTests.cs (31)
57var tree1 = SyntaxFactory.ParseSyntaxTree(text1); 58var tree2 = SyntaxFactory.ParseSyntaxTree(text2); 226var tree1 = SyntaxFactory.ParseSyntaxTree(text1); 227var tree2 = SyntaxFactory.ParseSyntaxTree(text2); 262new[] { SyntaxFactory.ParseSyntaxTree(code) }, 271var underlyingTree = SyntaxFactory.ParseSyntaxTree(@" 280var foreignType = SyntaxFactory.ParseSyntaxTree(@" 318var underlyingTree = SyntaxFactory.ParseSyntaxTree(@" 327var foreignType = SyntaxFactory.ParseSyntaxTree(@" 361var firstTree = SyntaxFactory.ParseSyntaxTree(@" 375var secondTree = SyntaxFactory.ParseSyntaxTree(@" 389var thirdTree = SyntaxFactory.ParseSyntaxTree(@" 428var firstTree = SyntaxFactory.ParseSyntaxTree(@" 442var secondTree = SyntaxFactory.ParseSyntaxTree(@" 474var firstTree = SyntaxFactory.ParseSyntaxTree(@" 488var secondTree = SyntaxFactory.ParseSyntaxTree(@" 517var firstTree = SyntaxFactory.ParseSyntaxTree(@" 536var secondTree = SyntaxFactory.ParseSyntaxTree(@" 577var firstTree = SyntaxFactory.ParseSyntaxTree(@" 596var secondTree = SyntaxFactory.ParseSyntaxTree(@" 631var firstTree = SyntaxFactory.ParseSyntaxTree(@" 645var secondTree = SyntaxFactory.ParseSyntaxTree(@" 674var firstTree = SyntaxFactory.ParseSyntaxTree(@" 688var secondTree = SyntaxFactory.ParseSyntaxTree(@" 717var firstTree = SyntaxFactory.ParseSyntaxTree(@" 733var secondTree = SyntaxFactory.ParseSyntaxTree(@" 764var firstTree = SyntaxFactory.ParseSyntaxTree(@" 780var secondTree = SyntaxFactory.ParseSyntaxTree(@" 809var firstTree = SyntaxFactory.ParseSyntaxTree(@" 823var secondTree = SyntaxFactory.ParseSyntaxTree(@" 854var firstTree = SyntaxFactory.ParseSyntaxTree(@"
DocumentationComments\CrefTests.cs (3)
6285var speculatedName = SyntaxFactory.ParseName("b"); 6342var accessorName = SyntaxFactory.ParseName(accessor.Name); 6357var inheritedTypeName = SyntaxFactory.ParseName(inheritedType.Name);
DocumentationComments\DocumentationCommentCompilerTests.cs (52)
759var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 760var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 887var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 888var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 926var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularWithDocumentationComments); 968var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 969var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1017var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1018var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1068var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1069var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1118var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1119var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1173var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1174var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1221var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1222var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1276var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1277var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1333var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1334var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1396var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1397var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1459var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 1460var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments); 1512var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularWithDocumentationComments); 1555var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1556var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1606var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1607var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1650var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularWithDocumentationComments); 1693var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1694var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1745var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1746var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1796var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1797var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1852var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1853var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1901var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1902var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 1957var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 1958var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 2015var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 2016var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 2079var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 2080var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 2143var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreviewWithDocumentationComments); 2144var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularPreviewWithDocumentationComments); 3227var newLeadingTrivia = SyntaxFactory.ParseToken("/** " + (_count++) + " */1)").LeadingTrivia; 5318var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments); 5319var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments);
SymbolDisplay\SymbolDisplayTests.cs (9)
3023var tree = SyntaxFactory.ParseSyntaxTree(text, TestOptions.Script); 6597var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6640var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6671var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6735var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6766var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6829var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6862var srcTree = SyntaxFactory.ParseSyntaxTree(@" 6907var srcTree = SyntaxFactory.ParseSyntaxTree(@"
Symbols\AnonymousTypesSymbolTests.cs (3)
1478var expr1 = SyntaxFactory.ParseExpression("new { x = 1, y" + i.ToString() + " = \"---\" }"); 1637var tree = SyntaxFactory.ParseSyntaxTree(source); 1678var tree = SyntaxFactory.ParseSyntaxTree(source);
Symbols\AssemblyAndNamespaceTests.cs (9)
118syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text) }, references: new MetadataReference[] { }); 122syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text1), SyntaxFactory.ParseSyntaxTree(text2) }, 165syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text1), SyntaxFactory.ParseSyntaxTree(text2) }, 251var comp1 = CSharpCompilation.Create(assemblyName: "Test1", options: TestOptions.DebugExe, syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text1) }, references: new MetadataReference[] { }); 252var comp2 = CSharpCompilation.Create(assemblyName: "Test2", options: TestOptions.DebugExe, syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text2) }, references: new MetadataReference[] { }); 258syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text3) }, 300syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text1) },
Symbols\CheckedUserDefinedOperatorsTests.cs (4)
7432var xNodeToSpeculate = SyntaxFactory.ParseExpression("-x"); 7433var yNodeToSpeculate = SyntaxFactory.ParseExpression("-y"); 7496var xNodeToSpeculate = SyntaxFactory.ParseExpression("-x"); 7497var yNodeToSpeculate = SyntaxFactory.ParseExpression("-y");
Symbols\CompilationCreationTests.cs (11)
32return SyntaxFactory.ParseSyntaxTree(text, path: path); 2684SyntaxFactory.ParseSyntaxTree($@" 2690SyntaxFactory.ParseSyntaxTree(@" 2694SyntaxFactory.ParseSyntaxTree(@" 2727SyntaxFactory.ParseSyntaxTree(@" 2732SyntaxFactory.ParseSyntaxTree(@" 2793new[] { SyntaxFactory.ParseSyntaxTree(@"#r ""bar""", TestOptions.Script, "a.csx", Encoding.UTF8) }, 2807SyntaxFactory.ParseSyntaxTree(@" 2811SyntaxFactory.ParseSyntaxTree(@" 2835SyntaxFactory.ParseSyntaxTree(@" 2861var st = SyntaxFactory.ParseSyntaxTree("class C { static void Main() { new lib.Class1(); } }");
Symbols\ConversionTests.cs (4)
385var tree = SyntaxFactory.ParseSyntaxTree(source); 413ExpressionSyntax sourceExpression3 = SyntaxFactory.IdentifierName("jj"); 419ExpressionSyntax sourceExpression4 = SyntaxFactory.IdentifierName("ss"); 423ExpressionSyntax sourceExpression5 = SyntaxFactory.ParseExpression("100L");
Symbols\ExtensionMethodTests.cs (3)
2423var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script.WithLanguageVersion(LanguageVersion.CSharp6)); 3820syntaxTree: SyntaxFactory.ParseSyntaxTree(source0, options: parseOptions), 3826syntaxTree: SyntaxFactory.ParseSyntaxTree(source1, options: parseOptions),
Symbols\Metadata\MetadataTypeTests.cs (1)
357var tree = SyntaxFactory.ParseSyntaxTree(String.Empty);
Symbols\Source\ClsComplianceTests.cs (2)
3497var tree1 = SyntaxFactory.ParseSyntaxTree(string.Format(sourceTemplate, 1), parseOptions, path: "a.cs"); 3498var tree2 = SyntaxFactory.ParseSyntaxTree(string.Format(sourceTemplate, 2), parseOptions, path: "b.cs");
Symbols\Source\DelegateTests.cs (1)
822var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular);
Symbols\Source\ExternAliasTests.cs (1)
112syntaxTree: SyntaxFactory.ParseSyntaxTree(src, options: TestOptions.Script),
Symbols\Source\FileModifierTests.cs (20)
730var verifier = CompileAndVerify(SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularPreview, path: "path/to/MyFile.cs", encoding: Encoding.Default), expectedOutput: "1", symbolValidator: symbolValidator); 773var verifier = CompileAndVerify(SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularPreview, path: "path/to/My<>File.cs", encoding: Encoding.Default), expectedOutput: "1", symbolValidator: symbolValidator); 804var verifier = CompileAndVerify(SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularPreview, path: "path/to/MyGeneratedFile.g.cs", encoding: Encoding.Default), expectedOutput: "1", symbolValidator: symbolValidator); 865var source1 = SyntaxFactory.ParseSyntaxTree(""" 875var source2 = SyntaxFactory.ParseSyntaxTree("", options: TestOptions.RegularPreview, path: path, encoding: Encoding.Default); 900var source1 = SyntaxFactory.ParseSyntaxTree(""" 910var source2 = SyntaxFactory.ParseSyntaxTree(""" 947var source1 = SyntaxFactory.ParseSyntaxTree(""" 957var source2 = SyntaxFactory.ParseSyntaxTree("", options: TestOptions.RegularPreview, path: path, encoding: Encoding.Default); 981var source1 = SyntaxFactory.ParseSyntaxTree(""" 991var source2 = SyntaxFactory.ParseSyntaxTree("", options: TestOptions.RegularPreview, path: "path/to/File.cs", encoding: Encoding.Default); 1086var comp = CreateCompilation(SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularPreview, path: $"path/to/My{badChar}File.cs", encoding: Encoding.Default)); 1113var comp = CreateCompilation(SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreview, path: "\uD800.cs")); 1148var verifier = CompileAndVerify(SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.RegularPreview, path: "path/to/My+File.cs", encoding: Encoding.Default), expectedOutput: "1", symbolValidator: validateSymbols); 3777var newBody = body.AddStatements(SyntaxFactory.ParseStatement("C.M();")); 3818var newBody = body.AddStatements(SyntaxFactory.ParseStatement("C.M();")); 4061SyntaxFactory.ParseSyntaxTree(source1, TestOptions.RegularPreview), 4062SyntaxFactory.ParseSyntaxTree(source2, TestOptions.RegularPreview, path: "path/to/FileB.cs") 4330var comp = CreateCompilation(SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularPreview, path: "path/to/SomeFile.cs")); 4584var tree = SyntaxFactory.ParseSyntaxTree("""
Symbols\Source\NullablePublicAPITests.cs (39)
1162var newSource = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("_ = o;"); 1365var newSource = (BlockSyntax)SyntaxFactory.ParseStatement(@"{ string? s3 = null; _ = s1 == """" ? s1 : s1; }"); 1372var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"s1"); 1373var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"s3 ??= s1", options: TestOptions.Regular8); 1442var newSource = (BlockSyntax)SyntaxFactory.ParseStatement("{ var y = x ?? new object(); y.ToString(); }"); 1517var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"s1"); 1518var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"s1 ??= """""); 1573var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"Prop"); 1574var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"Prop ??= """""); 2135var newDeclaration = SyntaxFactory.ParseStatement("var o5 = s2;"); 3700var @return = (ReturnStatementSyntax)SyntaxFactory.ParseStatement("return s;"); 3735var @return = (ReturnStatementSyntax)SyntaxFactory.ParseStatement("return s;"); 3778var newStatement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("_ = o1;"); 4064var speculativeAttribute = SyntaxFactory.Attribute(SyntaxFactory.ParseName("A"), SyntaxFactory.ParseAttributeArgumentList("(o2)")); 4069var speculativeInitializer = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("o1")); 4212var newAttributeUsage = SyntaxFactory.Attribute(SyntaxFactory.ParseName("Attr"), SyntaxFactory.ParseAttributeArgumentList("(Constant)")); 4243var type = SyntaxFactory.ParseTypeName("string"); 4367var statement = SyntaxFactory.ParseStatement(@"M(out C c);"); 4395var statement = SyntaxFactory.ParseStatement(@"M(out C c);"); 4423var statement = SyntaxFactory.ParseStatement(@" 4453var statement = SyntaxFactory.ParseStatement(@" 4483var statement = SyntaxFactory.ParseStatement(@" 4513var methodDeclaration = (MethodDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration(@" 4545var methodDeclaration = (MethodDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration(@" 4578var arrow = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(" M(out C c)")); 4606var arrow = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(@" 4639var newInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer, SyntaxFactory.ParseArgumentList(@"(M(out C c))")); 4670var newInitializer = SyntaxFactory.ConstructorInitializer(SyntaxKind.ThisConstructorInitializer, SyntaxFactory.ParseArgumentList(@"( 4701var expression = SyntaxFactory.ParseExpression(@"M(out C c)"); 4911var newBody = SyntaxFactory.ParseStatement("Prop.ToString();");
Symbols\Source\PropertyTests.cs (2)
2606syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(refSrc) }, 2698syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(refSrc) },
Symbols\StaticAbstractMembersInInterfacesTests.cs (2)
17495private static string UnaryOperatorName(string op, bool isChecked = false) => OperatorFacts.UnaryOperatorNameFromSyntaxKindIfAny(SyntaxFactory.ParseToken(op).Kind(), isChecked: isChecked); 17497op switch { ">>" => WellKnownMemberNames.RightShiftOperatorName, ">>>" => WellKnownMemberNames.UnsignedRightShiftOperatorName, _ => OperatorFacts.BinaryOperatorNameFromSyntaxKindIfAny(SyntaxFactory.ParseToken(op).Kind(), isChecked: isChecked) };
Symbols\SymbolErrorTests.cs (6)
4323var tree1 = SyntaxFactory.ParseCompilationUnit(text1); 4328var tree2 = SyntaxFactory.ParseCompilationUnit(text2); 15809var tree1 = SyntaxFactory.ParseCompilationUnit(text1); 15825var tree2 = SyntaxFactory.ParseCompilationUnit(text2); 15844var tree3 = SyntaxFactory.ParseCompilationUnit(text3); 20480var submission = CSharpCompilation.CreateScriptCompilation("s0.dll", SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Script), new[] { MscorlibRef_v4_0_30316_17626, SystemCoreRef });
Symbols\TypeResolutionTests.cs (5)
65syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(source2) }, 119syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree("class C { }") }, 168var c1 = CSharpCompilation.Create("Asm1", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); 169var c2 = CSharpCompilation.Create("Asm2", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); 184syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) });
Symbols\TypeTests.cs (3)
901var tree = SyntaxFactory.ParseSyntaxTree(text); 1675var tree = SyntaxFactory.ParseSyntaxTree(text); 1759var tree = SyntaxFactory.ParseSyntaxTree(text);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2107)
Diagnostics\DiagnosticTest.cs (3)
2356SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text, path: "goo.cs"); 2385SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text, path: "goo.cs"); 2403SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text, path: "goo.cs");
Diagnostics\LineSpanDirectiveTests.cs (8)
41var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "b.cs"); 87var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "b.cs"); 134var tree = SyntaxFactory.ParseSyntaxTree(source); 183var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "b.cs"); 233var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "page.razor.g.cs"); 301var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "page.razor.g.cs"); 353var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "page.razor.g.cs"); 411var treeB = SyntaxFactory.ParseSyntaxTree(sourceB, path: "a.razor.g.cs");
Diagnostics\LocationsTests.cs (28)
87SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 144SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "goo.cs"); 182SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 198AssertMappedSpanEqual(SyntaxFactory.ParseSyntaxTree(sampleProgram, path: ""), "class X {}", "", 19, 0, 19, 10, hasMappedPath: false); 199AssertMappedSpanEqual(SyntaxFactory.ParseSyntaxTree(sampleProgram, path: " "), "class X {}", " ", 19, 0, 19, 10, hasMappedPath: false); 214SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "filename.cs"); 235SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 251var syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 265var syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 285var syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 309SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 329syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 349syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 372SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 394SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 410SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram); 427SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram); 428SyntaxTree tree2 = SyntaxFactory.ParseSyntaxTree(sampleProgram); 454SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram, path: "c:\\goo.cs"); 488SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(sampleProgram); 554var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(SyntaxFactory.TriviaList(SyntaxFactory.Whitespace(" ")), "x", default(SyntaxTriviaList))); 559var tree = SyntaxFactory.SyntaxTree(nodeWithBadError); 583var node = SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken); 586var nodeWithBadError = SyntaxFactory.IdentifierName(new SyntaxToken(node.Node.WithDiagnosticsGreen(new DiagnosticInfo[] { new SyntaxDiagnosticInfo(10, 10, ErrorCode.ERR_NoBaseClass) }))); 587var tree = SyntaxFactory.SyntaxTree(nodeWithBadError);
Generated\Syntax.Test.xml.Generated.cs (656)
10230=> SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("Identifier")); 10233=> SyntaxFactory.QualifiedName(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.DotToken), GenerateIdentifierName()); 10236=> SyntaxFactory.GenericName(SyntaxFactory.Identifier("Identifier"), GenerateTypeArgumentList()); 10239=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), new SeparatedSyntaxList<TypeSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10242=> SyntaxFactory.AliasQualifiedName(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonColonToken), GenerateIdentifierName()); 10245=> SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.BoolKeyword)); 10248=> SyntaxFactory.ArrayType(GenerateIdentifierName(), new SyntaxList<ArrayRankSpecifierSyntax>()); 10251=> SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<ExpressionSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10254=> SyntaxFactory.PointerType(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.AsteriskToken)); 10257=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default(FunctionPointerCallingConventionSyntax), GenerateFunctionPointerParameterList()); 10260=> SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), new SeparatedSyntaxList<FunctionPointerParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10263=> SyntaxFactory.FunctionPointerCallingConvention(SyntaxFactory.Token(SyntaxKind.ManagedKeyword), default(FunctionPointerUnmanagedCallingConventionListSyntax)); 10266=> SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10269=> SyntaxFactory.FunctionPointerUnmanagedCallingConvention(SyntaxFactory.Identifier("Name")); 10272=> SyntaxFactory.NullableType(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.QuestionToken)); 10275=> SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<TupleElementSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10278=> SyntaxFactory.TupleElement(GenerateIdentifierName(), default(SyntaxToken)); 10281=> SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 10284=> SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default(SyntaxToken), GenerateIdentifierName()); 10287=> SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), GenerateIdentifierName()); 10290=> SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10293=> SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10296=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryPlusExpression, SyntaxFactory.Token(SyntaxKind.PlusToken), GenerateIdentifierName()); 10299=> SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), GenerateIdentifierName()); 10302=> SyntaxFactory.PostfixUnaryExpression(SyntaxKind.PostIncrementExpression, GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.PlusPlusToken)); 10305=> SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.DotToken), GenerateIdentifierName()); 10308=> SyntaxFactory.ConditionalAccessExpression(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.QuestionToken), GenerateIdentifierName()); 10311=> SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), GenerateIdentifierName()); 10314=> SyntaxFactory.ElementBindingExpression(GenerateBracketedArgumentList()); 10317=> SyntaxFactory.RangeExpression(default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.DotDotToken), default(ExpressionSyntax)); 10320=> SyntaxFactory.ImplicitElementAccess(GenerateBracketedArgumentList()); 10323=> SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.PlusToken), GenerateIdentifierName()); 10326=> SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EqualsToken), GenerateIdentifierName()); 10329=> SyntaxFactory.ConditionalExpression(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.QuestionToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonToken), GenerateIdentifierName()); 10332=> SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); 10335=> SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); 10338=> SyntaxFactory.LiteralExpression(SyntaxKind.ArgListExpression, SyntaxFactory.Token(SyntaxKind.ArgListKeyword)); 10341=> SyntaxFactory.FieldExpression(SyntaxFactory.Token(SyntaxKind.FieldKeyword)); 10344=> SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10347=> SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10350=> SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CommaToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10353=> SyntaxFactory.CheckedExpression(SyntaxKind.CheckedExpression, SyntaxFactory.Token(SyntaxKind.CheckedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10356=> SyntaxFactory.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10359=> SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10362=> SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10365=> SyntaxFactory.InvocationExpression(GenerateIdentifierName(), GenerateArgumentList()); 10368=> SyntaxFactory.ElementAccessExpression(GenerateIdentifierName(), GenerateBracketedArgumentList()); 10371=> SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10374=> SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10377=> SyntaxFactory.Argument(default(NameColonSyntax), default(SyntaxToken), GenerateIdentifierName()); 10380=> SyntaxFactory.ExpressionColon(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10383=> SyntaxFactory.NameColon(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10386=> SyntaxFactory.DeclarationExpression(GenerateIdentifierName(), GenerateSingleVariableDesignation()); 10389=> SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateIdentifierName()); 10392=> SyntaxFactory.AnonymousMethodExpression(new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), default(ParameterListSyntax), GenerateBlock(), default(ExpressionSyntax)); 10395=> SyntaxFactory.SimpleLambdaExpression(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateParameter(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default(BlockSyntax), default(ExpressionSyntax)); 10398=> SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), GenerateIdentifierName()); 10401=> SyntaxFactory.ParenthesizedLambdaExpression(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax), GenerateParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default(BlockSyntax), default(ExpressionSyntax)); 10404=> SyntaxFactory.InitializerExpression(SyntaxKind.ObjectInitializerExpression, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SeparatedSyntaxList<ExpressionSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10407=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), GenerateArgumentList(), default(InitializerExpressionSyntax)); 10410=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), GenerateIdentifierName(), default(ArgumentListSyntax), default(InitializerExpressionSyntax)); 10413=> SyntaxFactory.WithExpression(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.WithKeyword), GenerateInitializerExpression()); 10416=> SyntaxFactory.AnonymousObjectMemberDeclarator(default(NameEqualsSyntax), GenerateIdentifierName()); 10419=> SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10422=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), GenerateArrayType(), default(InitializerExpressionSyntax)); 10425=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), GenerateInitializerExpression()); 10428=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), GenerateIdentifierName(), default(InitializerExpressionSyntax)); 10431=> SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), GenerateInitializerExpression()); 10434=> SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<CollectionElementSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10437=> SyntaxFactory.ExpressionElement(GenerateIdentifierName()); 10440=> SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), GenerateIdentifierName()); 10443=> SyntaxFactory.QueryExpression(GenerateFromClause(), GenerateQueryBody()); 10446=> SyntaxFactory.QueryBody(new SyntaxList<QueryClauseSyntax>(), GenerateSelectClause(), default(QueryContinuationSyntax)); 10449=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName()); 10452=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.EqualsToken), GenerateIdentifierName()); 10455=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.OnKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EqualsKeyword), GenerateIdentifierName(), default(JoinIntoClauseSyntax)); 10458=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier("Identifier")); 10461=> SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), GenerateIdentifierName()); 10464=> SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), new SeparatedSyntaxList<OrderingSyntax>()); 10467=> SyntaxFactory.Ordering(SyntaxKind.AscendingOrdering, GenerateIdentifierName(), default(SyntaxToken)); 10470=> SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), GenerateIdentifierName()); 10473=> SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ByKeyword), GenerateIdentifierName()); 10476=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier("Identifier"), GenerateQueryBody()); 10479=> SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 10482=> SyntaxFactory.InterpolatedStringExpression(SyntaxFactory.Token(SyntaxKind.InterpolatedStringStartToken), new SyntaxList<InterpolatedStringContentSyntax>(), SyntaxFactory.Token(SyntaxKind.InterpolatedStringEndToken)); 10485=> SyntaxFactory.IsPatternExpression(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.IsKeyword), GenerateDiscardPattern()); 10488=> SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), GenerateIdentifierName()); 10491=> SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), GenerateIdentifierName()); 10494=> SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 10497=> SyntaxFactory.DeclarationPattern(GenerateIdentifierName(), GenerateSingleVariableDesignation()); 10500=> SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), GenerateSingleVariableDesignation()); 10503=> SyntaxFactory.RecursivePattern(default(TypeSyntax), default(PositionalPatternClauseSyntax), default(PropertyPatternClauseSyntax), default(VariableDesignationSyntax)); 10506=> SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<SubpatternSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10509=> SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SeparatedSyntaxList<SubpatternSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10512=> SyntaxFactory.Subpattern(default(BaseExpressionColonSyntax), GenerateDiscardPattern()); 10515=> SyntaxFactory.ConstantPattern(GenerateIdentifierName()); 10518=> SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateDiscardPattern(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10521=> SyntaxFactory.RelationalPattern(SyntaxFactory.Token(SyntaxKind.EqualsEqualsToken), GenerateIdentifierName()); 10524=> SyntaxFactory.TypePattern(GenerateIdentifierName()); 10527=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, GenerateDiscardPattern(), SyntaxFactory.Token(SyntaxKind.OrKeyword), GenerateDiscardPattern()); 10530=> SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), GenerateDiscardPattern()); 10533=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<PatternSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default(VariableDesignationSyntax)); 10536=> SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), default(PatternSyntax)); 10539=> SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 10542=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), GenerateIdentifierName(), default(InterpolationAlignmentClauseSyntax), default(InterpolationFormatClauseSyntax), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10545=> SyntaxFactory.InterpolationAlignmentClause(SyntaxFactory.Identifier("CommaToken"), GenerateIdentifierName()); 10548=> SyntaxFactory.InterpolationFormatClause(SyntaxFactory.Identifier("ColonToken"), SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 10551=> SyntaxFactory.GlobalStatement(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateBlock()); 10554=> SyntaxFactory.Block(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<StatementSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10557=> SyntaxFactory.LocalFunctionStatement(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName(), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), GenerateParameterList(), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10560=> SyntaxFactory.LocalDeclarationStatement(new SyntaxList<AttributeListSyntax>(), default(SyntaxToken), default(SyntaxToken), new SyntaxTokenList(), GenerateVariableDeclaration(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10563=> SyntaxFactory.VariableDeclaration(GenerateIdentifierName(), new SeparatedSyntaxList<VariableDeclaratorSyntax>()); 10566=> SyntaxFactory.VariableDeclarator(SyntaxFactory.Identifier("Identifier"), default(BracketedArgumentListSyntax), default(EqualsValueClauseSyntax)); 10569=> SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), GenerateIdentifierName()); 10572=> SyntaxFactory.SingleVariableDesignation(SyntaxFactory.Identifier("Identifier")); 10575=> SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 10578=> SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<VariableDesignationSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10581=> SyntaxFactory.ExpressionStatement(new SyntaxList<AttributeListSyntax>(), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10584=> SyntaxFactory.EmptyStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10587=> SyntaxFactory.LabeledStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.ColonToken), GenerateBlock()); 10590=> SyntaxFactory.GotoStatement(SyntaxKind.GotoStatement, new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.GotoKeyword), default(SyntaxToken), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10593=> SyntaxFactory.BreakStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10596=> SyntaxFactory.ContinueStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10599=> SyntaxFactory.ReturnStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.ReturnKeyword), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10602=> SyntaxFactory.ThrowStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.ThrowKeyword), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10605=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(SyntaxKind.ReturnKeyword), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10608=> SyntaxFactory.WhileStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10611=> SyntaxFactory.DoStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.DoKeyword), GenerateBlock(), SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10614=> SyntaxFactory.ForStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.ForKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default(VariableDeclarationSyntax), new SeparatedSyntaxList<ExpressionSyntax>(), SyntaxFactory.Token(SyntaxKind.SemicolonToken), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.SemicolonToken), new SeparatedSyntaxList<ExpressionSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10617=> SyntaxFactory.ForEachStatement(new SyntaxList<AttributeListSyntax>(), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10620=> SyntaxFactory.ForEachVariableStatement(new SyntaxList<AttributeListSyntax>(), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10623=> SyntaxFactory.UsingStatement(new SyntaxList<AttributeListSyntax>(), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default(VariableDeclarationSyntax), default(ExpressionSyntax), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10626=> SyntaxFactory.FixedStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateVariableDeclaration(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10629=> SyntaxFactory.CheckedStatement(SyntaxKind.CheckedStatement, new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.CheckedKeyword), GenerateBlock()); 10632=> SyntaxFactory.UnsafeStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), GenerateBlock()); 10635=> SyntaxFactory.LockStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock()); 10638=> SyntaxFactory.IfStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken), GenerateBlock(), default(ElseClauseSyntax)); 10641=> SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), GenerateBlock()); 10644=> SyntaxFactory.SwitchStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.SwitchKeyword), default(SyntaxToken), GenerateIdentifierName(), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<SwitchSectionSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10647=> SyntaxFactory.SwitchSection(new SyntaxList<SwitchLabelSyntax>(), new SyntaxList<StatementSyntax>()); 10650=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), GenerateDiscardPattern(), default(WhenClauseSyntax), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10653=> SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10656=> SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10659=> SyntaxFactory.SwitchExpression(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SeparatedSyntaxList<SwitchExpressionArmSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10662=> SyntaxFactory.SwitchExpressionArm(GenerateDiscardPattern(), default(WhenClauseSyntax), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), GenerateIdentifierName()); 10665=> SyntaxFactory.TryStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.TryKeyword), GenerateBlock(), new SyntaxList<CatchClauseSyntax>(), default(FinallyClauseSyntax)); 10668=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default(CatchDeclarationSyntax), default(CatchFilterClauseSyntax), GenerateBlock()); 10671=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10674=> SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10677=> SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), GenerateBlock()); 10680=> SyntaxFactory.CompilationUnit(new SyntaxList<ExternAliasDirectiveSyntax>(), new SyntaxList<UsingDirectiveSyntax>(), new SyntaxList<AttributeListSyntax>(), new SyntaxList<MemberDeclarationSyntax>(), SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 10683=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10686=> SyntaxFactory.UsingDirective(default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.UsingKeyword), default(SyntaxToken), default(SyntaxToken), default(NameEqualsSyntax), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10689=> SyntaxFactory.NamespaceDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<ExternAliasDirectiveSyntax>(), new SyntaxList<UsingDirectiveSyntax>(), new SyntaxList<MemberDeclarationSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default(SyntaxToken)); 10692=> SyntaxFactory.FileScopedNamespaceDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.SemicolonToken), new SyntaxList<ExternAliasDirectiveSyntax>(), new SyntaxList<UsingDirectiveSyntax>(), new SyntaxList<MemberDeclarationSyntax>()); 10695=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(AttributeTargetSpecifierSyntax), new SeparatedSyntaxList<AttributeSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10698=> SyntaxFactory.AttributeTargetSpecifier(SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10701=> SyntaxFactory.Attribute(GenerateIdentifierName(), default(AttributeArgumentListSyntax)); 10704=> SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<AttributeArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10707=> SyntaxFactory.AttributeArgument(default(NameEqualsSyntax), default(NameColonSyntax), GenerateIdentifierName()); 10710=> SyntaxFactory.NameEquals(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EqualsToken)); 10713=> SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), new SeparatedSyntaxList<TypeParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10716=> SyntaxFactory.TypeParameter(new SyntaxList<AttributeListSyntax>(), default(SyntaxToken), SyntaxFactory.Identifier("Identifier")); 10719=> SyntaxFactory.ClassDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.ClassKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(SyntaxToken), new SyntaxList<MemberDeclarationSyntax>(), default(SyntaxToken), default(SyntaxToken)); 10722=> SyntaxFactory.StructDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.StructKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(SyntaxToken), new SyntaxList<MemberDeclarationSyntax>(), default(SyntaxToken), default(SyntaxToken)); 10725=> SyntaxFactory.InterfaceDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(SyntaxToken), new SyntaxList<MemberDeclarationSyntax>(), default(SyntaxToken), default(SyntaxToken)); 10728=> SyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Identifier("Keyword"), default(SyntaxToken), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(SyntaxToken), new SyntaxList<MemberDeclarationSyntax>(), default(SyntaxToken), default(SyntaxToken)); 10731=> SyntaxFactory.EnumDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.EnumKeyword), SyntaxFactory.Identifier("Identifier"), default(BaseListSyntax), default(SyntaxToken), new SeparatedSyntaxList<EnumMemberDeclarationSyntax>(), default(SyntaxToken), default(SyntaxToken)); 10734=> SyntaxFactory.DelegateDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), GenerateIdentifierName(), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), GenerateParameterList(), new SyntaxList<TypeParameterConstraintClauseSyntax>(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10737=> SyntaxFactory.EnumMemberDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Identifier("Identifier"), default(EqualsValueClauseSyntax)); 10740=> SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), new SeparatedSyntaxList<BaseTypeSyntax>()); 10743=> SyntaxFactory.SimpleBaseType(GenerateIdentifierName()); 10746=> SyntaxFactory.PrimaryConstructorBaseType(GenerateIdentifierName(), GenerateArgumentList()); 10749=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.ColonToken), new SeparatedSyntaxList<TypeParameterConstraintSyntax>()); 10752=> SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10755=> SyntaxFactory.ClassOrStructConstraint(SyntaxKind.ClassConstraint, SyntaxFactory.Token(SyntaxKind.ClassKeyword), default(SyntaxToken)); 10758=> SyntaxFactory.TypeConstraint(GenerateIdentifierName()); 10761=> SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); 10764=> SyntaxFactory.AllowsConstraintClause(SyntaxFactory.Token(SyntaxKind.AllowsKeyword), new SeparatedSyntaxList<AllowsConstraintSyntax>()); 10767=> SyntaxFactory.RefStructConstraint(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.StructKeyword)); 10770=> SyntaxFactory.FieldDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateVariableDeclaration(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10773=> SyntaxFactory.EventFieldDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.EventKeyword), GenerateVariableDeclaration(), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 10776=> SyntaxFactory.ExplicitInterfaceSpecifier(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.DotToken)); 10779=> SyntaxFactory.MethodDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName(), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), GenerateParameterList(), new SyntaxList<TypeParameterConstraintClauseSyntax>(), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10782=> SyntaxFactory.OperatorDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName(), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.PlusToken), GenerateParameterList(), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10785=> SyntaxFactory.ConversionOperatorDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.ImplicitKeyword), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default(SyntaxToken), GenerateIdentifierName(), GenerateParameterList(), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10788=> SyntaxFactory.ConstructorDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Identifier("Identifier"), GenerateParameterList(), default(ConstructorInitializerSyntax), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10791=> SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(SyntaxKind.BaseKeyword), GenerateArgumentList()); 10794=> SyntaxFactory.DestructorDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier("Identifier"), GenerateParameterList(), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10797=> SyntaxFactory.PropertyDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName(), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Identifier("Identifier"), default(AccessorListSyntax), default(ArrowExpressionClauseSyntax), default(EqualsValueClauseSyntax), default(SyntaxToken)); 10800=> SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), GenerateIdentifierName()); 10803=> SyntaxFactory.EventDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.EventKeyword), GenerateIdentifierName(), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Identifier("Identifier"), default(AccessorListSyntax), default(SyntaxToken)); 10806=> SyntaxFactory.IndexerDeclaration(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName(), default(ExplicitInterfaceSpecifierSyntax), SyntaxFactory.Token(SyntaxKind.ThisKeyword), GenerateBracketedParameterList(), default(AccessorListSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10809=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<AccessorDeclarationSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10812=> SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.GetKeyword), default(BlockSyntax), default(ArrowExpressionClauseSyntax), default(SyntaxToken)); 10815=> SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<ParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10818=> SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<ParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10821=> SyntaxFactory.Parameter(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), default(EqualsValueClauseSyntax)); 10824=> SyntaxFactory.FunctionPointerParameter(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), GenerateIdentifierName()); 10827=> SyntaxFactory.IncompleteMember(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax)); 10830=> SyntaxFactory.SkippedTokensTrivia(new SyntaxTokenList()); 10833=> SyntaxFactory.DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, new SyntaxList<XmlNodeSyntax>(), SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); 10836=> SyntaxFactory.TypeCref(GenerateIdentifierName()); 10839=> SyntaxFactory.QualifiedCref(GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.DotToken), GenerateNameMemberCref()); 10842=> SyntaxFactory.NameMemberCref(GenerateIdentifierName(), default(CrefParameterListSyntax)); 10845=> SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), default(CrefBracketedParameterListSyntax)); 10848=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.PlusToken), default(CrefParameterListSyntax)); 10851=> SyntaxFactory.ConversionOperatorMemberCref(SyntaxFactory.Token(SyntaxKind.ImplicitKeyword), SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default(SyntaxToken), GenerateIdentifierName(), default(CrefParameterListSyntax)); 10854=> SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<CrefParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10857=> SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<CrefParameterSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10860=> SyntaxFactory.CrefParameter(default(SyntaxToken), default(SyntaxToken), GenerateIdentifierName()); 10863=> SyntaxFactory.XmlElement(GenerateXmlElementStartTag(), new SyntaxList<XmlNodeSyntax>(), GenerateXmlElementEndTag()); 10866=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), GenerateXmlName(), new SyntaxList<XmlAttributeSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10869=> SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), GenerateXmlName(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10872=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), GenerateXmlName(), new SyntaxList<XmlAttributeSyntax>(), SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 10875=> SyntaxFactory.XmlName(default(XmlPrefixSyntax), SyntaxFactory.Identifier("LocalName")); 10878=> SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier("Prefix"), SyntaxFactory.Token(SyntaxKind.ColonToken)); 10881=> SyntaxFactory.XmlTextAttribute(GenerateXmlName(), SyntaxFactory.Token(SyntaxKind.EqualsToken), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken)); 10884=> SyntaxFactory.XmlCrefAttribute(GenerateXmlName(), SyntaxFactory.Token(SyntaxKind.EqualsToken), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken), GenerateTypeCref(), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken)); 10887=> SyntaxFactory.XmlNameAttribute(GenerateXmlName(), SyntaxFactory.Token(SyntaxKind.EqualsToken), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.SingleQuoteToken)); 10890=> SyntaxFactory.XmlText(new SyntaxTokenList()); 10893=> SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); 10896=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), GenerateXmlName(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 10899=> SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); 10902=> SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool(), new bool(), new bool()); 10905=> SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool(), new bool(), new bool()); 10908=> SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool(), new bool()); 10911=> SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10914=> SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10917=> SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10920=> SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10923=> SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10926=> SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10929=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier("Name"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10932=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier("Name"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10935=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), SyntaxFactory.Literal("1", 1), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10938=> SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Literal("1", 1), SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.Literal("1", 1), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10941=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), GenerateLineDirectivePosition(), SyntaxFactory.Token(SyntaxKind.MinusToken), GenerateLineDirectivePosition(), default(SyntaxToken), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10944=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.DisableKeyword), new SeparatedSyntaxList<ExpressionSyntax>(), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10947=> SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10950=> SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10953=> SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), SyntaxFactory.Literal("string", "string"), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10956=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool()); 10959=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), SyntaxFactory.Token(SyntaxKind.EnableKeyword), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), new bool());
IncrementalParsing\BinaryExpression.cs (2)
29var oldTree = SyntaxFactory.ParseSyntaxTree(text); 197var oldTree = SyntaxFactory.ParseSyntaxTree(topLevel ? topLevelStatement : code, options: options);
IncrementalParsing\ChangingAsync.cs (1)
67var oldTree = SyntaxFactory.ParseSyntaxTree(text);
IncrementalParsing\ChangingIdentifiers.cs (1)
264var oldTree = SyntaxFactory.ParseSyntaxTree(code, options: options);
IncrementalParsing\CompoundAssignment.cs (1)
103var oldTree = SyntaxFactory.ParseSyntaxTree(topLevel ? topLevelStatement : code, options: options);
IncrementalParsing\GrammarAmbiguities.cs (2)
90var originalTree = SyntaxFactory.ParseSyntaxTree(code); 104var parsedRoot = SyntaxFactory.ParseCompilationUnit(syntaxTree.GetText().ToString());
IncrementalParsing\IncrementalParsingTests.cs (105)
30return SyntaxFactory.ParseSyntaxTree(itext, options); 37return SyntaxFactory.ParseSyntaxTree(itext, options); 182var interfaceKeyword = SyntaxFactory.ParseToken("interface"); // prime the memoizer 200var interfaceKeyword = SyntaxFactory.ParseToken("struct"); // prime the memoizer 436var oldTree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script); 460var oldTree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script); 490var tree = SyntaxFactory.ParseSyntaxTree(source); 500var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 522var tree = SyntaxFactory.ParseSyntaxTree(source); 532var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 562var tree = SyntaxFactory.ParseSyntaxTree(source); 579var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 613var initialTree = SyntaxFactory.ParseSyntaxTree(initialSource); 843var fullTree = SyntaxFactory.ParseSyntaxTree(withCloseBraceDeletedText.ToString()); 913var startTree = SyntaxFactory.ParseSyntaxTree(text); 962var startTree = SyntaxFactory.ParseSyntaxTree(text); 976var startTree = SyntaxFactory.ParseSyntaxTree(text); 1183SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(startingText); 1204SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(startingText); 1223SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(startingText); 1429SyntaxTree oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 1444var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 1458SyntaxTree origTree = SyntaxFactory.ParseSyntaxTree(oldText); 1466SyntaxTree fullTree = SyntaxFactory.ParseSyntaxTree(newText); 1576var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 1982var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 2745var tree = SyntaxFactory.ParseSyntaxTree(text); 2752var parsedTree = SyntaxFactory.ParseSyntaxTree(text2); 2766var startTree = SyntaxFactory.ParseSyntaxTree(oldText); 2772var parsedTree = SyntaxFactory.ParseSyntaxTree(newText); 2782var startTree = SyntaxFactory.ParseSyntaxTree(oldText, options: TestOptions.Script); 2795var parsedTree = SyntaxFactory.ParseSyntaxTree(newText, options: TestOptions.Script); 2811var startTree = SyntaxFactory.ParseSyntaxTree(oldText, options: TestOptions.Script); 2826var parsedTree = SyntaxFactory.ParseSyntaxTree(newText, options: TestOptions.Script); 2841var startTree = SyntaxFactory.ParseSyntaxTree(oldText, options: TestOptions.Script); 2853var parsedTree = SyntaxFactory.ParseSyntaxTree(newText, options: TestOptions.Script); 2896var comp = CSharpTestBase.CreateCompilation(SyntaxFactory.ParseSyntaxTree(String.Empty)); 2906var fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2920fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2976var currTree = SyntaxFactory.ParseSyntaxTree(text); 2990var fullTree = SyntaxFactory.ParseSyntaxTree(currIText.ToString()); 3016var currTree = SyntaxFactory.ParseSyntaxTree(text); 3026var fullTree = SyntaxFactory.ParseSyntaxTree(currIText.ToString()); 3044var oldTree = SyntaxFactory.ParseSyntaxTree(text); 3053var tempTree = SyntaxFactory.ParseSyntaxTree(text); 3060var oldTree = SyntaxFactory.SyntaxTree(oldRoot, options: tempTree.Options, path: tempTree.FilePath); 3098var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); // f is a simple lambda parameter 3104var fullTree = SyntaxFactory.ParseSyntaxTree(newText); 3116var interfaceKeyword = SyntaxFactory.ParseToken("interface"); // prime the memoizer 3181var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 3183WalkTreeAndVerify(newTree.GetCompilationUnitRoot(), SyntaxFactory.ParseSyntaxTree(newText).GetCompilationUnitRoot()); 3196var tree = SyntaxFactory.ParseSyntaxTree(source); 3202var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3217var tree = SyntaxFactory.ParseSyntaxTree(src); 3223var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3238var tree = SyntaxFactory.ParseSyntaxTree(source); 3244var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3259var tree = SyntaxFactory.ParseSyntaxTree(source); 3265var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3280var tree = SyntaxFactory.ParseSyntaxTree(source); 3286var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3301var tree = SyntaxFactory.ParseSyntaxTree(source); 3308var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3325var tree = SyntaxFactory.ParseSyntaxTree(source); 3332var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3349var tree = SyntaxFactory.ParseSyntaxTree(source); 3356var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3373var tree = SyntaxFactory.ParseSyntaxTree(source); 3380var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3397var tree = SyntaxFactory.ParseSyntaxTree(source); 3404var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3421var tree = SyntaxFactory.ParseSyntaxTree(source); 3428var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3447var tree = SyntaxFactory.ParseSyntaxTree(source); 3454var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3473var tree = SyntaxFactory.ParseSyntaxTree(source); 3479var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3498var tree = SyntaxFactory.ParseSyntaxTree(source); 3505var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3524var tree = SyntaxFactory.ParseSyntaxTree(source); 3531var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3542var tree = SyntaxFactory.ParseSyntaxTree(source); 3549var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3560var tree = SyntaxFactory.ParseSyntaxTree(source); 3567var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3578var tree = SyntaxFactory.ParseSyntaxTree(source); 3585var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3593var tree = SyntaxFactory.ParseSyntaxTree(source); 3599var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3607var tree = SyntaxFactory.ParseSyntaxTree(source); 3613var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3621var tree = SyntaxFactory.ParseSyntaxTree(source); 3628var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3659var tree = SyntaxFactory.ParseSyntaxTree(source); 3665var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3680var tree = SyntaxFactory.ParseSyntaxTree(source); 3702var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3731var tree = SyntaxFactory.ParseSyntaxTree(oldText); 3733parsedTree = SyntaxFactory.ParseSyntaxTree(newText); 3739var tree = SyntaxFactory.ParseSyntaxTree(oldText); 3741parsedTree = SyntaxFactory.ParseSyntaxTree(newText); 3760var startTree = SyntaxFactory.ParseSyntaxTree(oldText); 3766parsedTree = SyntaxFactory.ParseSyntaxTree(newText); 3771var startTree = SyntaxFactory.ParseSyntaxTree(oldText); 3774parsedTree = SyntaxFactory.ParseSyntaxTree(newText);
IncrementalParsing\TypeChanges.cs (1)
155var oldTree = SyntaxFactory.ParseSyntaxTree(text);
IncrementalParsing\UnaryExpression.cs (1)
79var oldTree = SyntaxFactory.ParseSyntaxTree(topLevel ? topLevelStatement : code, options: options);
LexicalAndXml\LexicalTests.cs (1)
43return SyntaxFactory.ParseTokens(text, options: options);
LexicalAndXml\PreprocessorTests.cs (4)
94return SyntaxFactory.ParseSyntaxTree(itext, options).GetCompilationUnitRoot(); 101return SyntaxFactory.ParseSyntaxTree(itext, options); 3213var tree = SyntaxFactory.ParseSyntaxTree(text, path: compilationFileName); 3874var tree = SyntaxFactory.ParseSyntaxTree(text);
LexicalAndXml\RawStringLiteralLexingTests.cs (2)
187var token = SyntaxFactory.ParseToken(input); 188var literal = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, token);
LexicalAndXml\SyntaxTokenParserTests.cs (16)
20var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 37var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 75var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 119var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 158var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 184var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 194var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 203var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 221var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 262var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 273var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 292var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 325var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 355var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 369var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular); 392var parser = SyntaxFactory.CreateTokenParser(sourceText, TestOptions.Regular);
LexicalAndXml\XmlDocCommentTests.cs (96)
35return SyntaxFactory.ParseSyntaxTree(itext, options); 2948DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 2949SyntaxFactory.XmlSummaryElement( 2950SyntaxFactory.XmlNewLine(Environment.NewLine), 2951SyntaxFactory.XmlText("This class provides extension methods for the "), 2952SyntaxFactory.XmlSeeElement( 2953SyntaxFactory.TypeCref(SyntaxFactory.ParseTypeName("TypeName"))), 2954SyntaxFactory.XmlText(" class."), 2955SyntaxFactory.XmlNewLine(Environment.NewLine)), 2956SyntaxFactory.XmlNewLine(Environment.NewLine), 2957SyntaxFactory.XmlThreadSafetyElement(), 2958SyntaxFactory.XmlNewLine(Environment.NewLine), 2959SyntaxFactory.XmlPreliminaryElement()); 2975DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 2976SyntaxFactory.XmlSummaryElement( 2977SyntaxFactory.XmlNewLine(Environment.NewLine), 2978SyntaxFactory.XmlText("This class provides extension methods."), 2979SyntaxFactory.XmlNewLine(Environment.NewLine))); 2995DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 2996SyntaxFactory.XmlSummaryElement( 2997SyntaxFactory.XmlNewLine(Environment.NewLine), 2998SyntaxFactory.XmlText("This class provides extension methods for the "), 2999SyntaxFactory.XmlSeeElement( 3000SyntaxFactory.TypeCref(SyntaxFactory.ParseTypeName("TypeName"))), 3001SyntaxFactory.XmlText(" class and the "), 3002SyntaxFactory.XmlSeeAlsoElement( 3003SyntaxFactory.TypeCref(SyntaxFactory.ParseTypeName("TypeName2"))), 3004SyntaxFactory.XmlText(" class."), 3005SyntaxFactory.XmlNewLine(Environment.NewLine))); 3016var docComment = SyntaxFactory.DocumentationComment( 3017SyntaxFactory.XmlSeeAlsoElement(new Uri("https://dotnet.microsoft.com/"), 3018SyntaxFactory.List(new XmlNodeSyntax[] { SyntaxFactory.XmlText(".NET") }))); 3039DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3040SyntaxFactory.XmlSummaryElement( 3041SyntaxFactory.XmlNewLine(Environment.NewLine), 3042SyntaxFactory.XmlText("This is a summary."), 3043SyntaxFactory.XmlNewLine(Environment.NewLine)), 3044SyntaxFactory.XmlNewLine(Environment.NewLine), 3045SyntaxFactory.XmlNewLine(Environment.NewLine), 3046SyntaxFactory.XmlNewLine(Environment.NewLine), 3047SyntaxFactory.XmlRemarksElement( 3048SyntaxFactory.XmlNewLine(Environment.NewLine), 3049SyntaxFactory.XmlNewLine(Environment.NewLine))); 3067DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3068SyntaxFactory.XmlSummaryElement( 3069SyntaxFactory.XmlNewLine(Environment.NewLine), 3070SyntaxFactory.XmlParamRefElement("b"), 3071SyntaxFactory.XmlNewLine(Environment.NewLine)), 3072SyntaxFactory.XmlNewLine(Environment.NewLine), 3073SyntaxFactory.XmlParamElement("a"), 3074SyntaxFactory.XmlNewLine(Environment.NewLine), 3075SyntaxFactory.XmlParamElement("b")); 3094DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3095SyntaxFactory.XmlSummaryElement( 3096SyntaxFactory.XmlNewLine(Environment.NewLine), 3097SyntaxFactory.XmlNewLine(Environment.NewLine)), 3098SyntaxFactory.XmlNewLine(Environment.NewLine), 3099SyntaxFactory.XmlReturnsElement( 3100SyntaxFactory.XmlNewLine(Environment.NewLine), 3101SyntaxFactory.XmlText("Returns a value."), 3102SyntaxFactory.XmlNewLine(Environment.NewLine))); 3121DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3122SyntaxFactory.XmlSummaryElement( 3123SyntaxFactory.XmlNewLine(Environment.NewLine), 3124SyntaxFactory.XmlNewLine(Environment.NewLine)), 3125SyntaxFactory.XmlNewLine(Environment.NewLine), 3126SyntaxFactory.XmlRemarksElement( 3127SyntaxFactory.XmlNewLine(Environment.NewLine), 3128SyntaxFactory.XmlText("Same as in class "), 3129SyntaxFactory.XmlSeeElement(SyntaxFactory.TypeCref(SyntaxFactory.ParseTypeName("TypeName"))), 3130SyntaxFactory.XmlText("."), 3131SyntaxFactory.XmlNewLine(Environment.NewLine))); 3148DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3149SyntaxFactory.XmlSummaryElement( 3150SyntaxFactory.XmlNewLine(Environment.NewLine), 3151SyntaxFactory.XmlNewLine(Environment.NewLine)), 3152SyntaxFactory.XmlNewLine(Environment.NewLine), 3153SyntaxFactory.XmlExceptionElement( 3154SyntaxFactory.TypeCref( 3155SyntaxFactory.ParseTypeName("InvalidOperationException")), 3156SyntaxFactory.XmlText("This exception will be thrown if the object is in an invalid state when calling this method."))); 3173DocumentationCommentTriviaSyntax documentationComment = SyntaxFactory.DocumentationComment( 3174SyntaxFactory.XmlSummaryElement( 3175SyntaxFactory.XmlNewLine(Environment.NewLine), 3176SyntaxFactory.XmlNewLine(Environment.NewLine)), 3177SyntaxFactory.XmlNewLine(Environment.NewLine), 3178SyntaxFactory.XmlPermissionElement( 3179SyntaxFactory.TypeCref( 3180SyntaxFactory.ParseTypeName("MyPermission")), 3181SyntaxFactory.XmlText("Needs MyPermission to execute.")));
Parsing\AsyncParsingTests.cs (2)
21return SyntaxFactory.ParseSyntaxTree(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp5)); 26return SyntaxFactory.ParseExpression(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp5));
Parsing\AsyncStreamsParsingTests.cs (2)
22return SyntaxFactory.ParseSyntaxTree(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp8)); 27return SyntaxFactory.ParseExpression(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp8));
Parsing\AwaitParsingTests.cs (2)
19return SyntaxFactory.ParseSyntaxTree(text); 24return SyntaxFactory.ParseExpression(text);
Parsing\CrefParsingTests.cs (1)
29var trivia = SyntaxFactory.ParseLeadingTrivia(commentText, options ?? CSharpParseOptions.Default).Single();
Parsing\DeclarationParsingTests.cs (1)
25return SyntaxFactory.ParseSyntaxTree(text, options ?? TestOptions.Regular);
Parsing\DeconstructionTests.cs (15)
34return SyntaxFactory.ParseSyntaxTree(text, options: options); 1878var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1891var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1903var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1915var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1927var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1944var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1961var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1975var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 1989var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 2005var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 2016var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 2027var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 2036var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature()); 2046var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature());
Parsing\ExpressionParsingTests.cs (4)
22return SyntaxFactory.ParseSyntaxTree(text, options: options); 27return SyntaxFactory.ParseExpression(text, options: options); 2988var expr = SyntaxFactory.ParseExpression(text); 3135var root = SyntaxFactory.ParseSyntaxTree(text).GetRoot();
Parsing\FileModifierParsingTests.cs (1)
21return SyntaxFactory.ParseSyntaxTree(text, options ?? TestOptions.Regular);
Parsing\InterpolatedStringExpressionTests.cs (7)
15Assert.Equal("$\"\"", SyntaxFactory.InterpolatedStringExpression(SyntaxFactory.Token(SyntaxKind.InterpolatedStringStartToken)).ToFullString()); 21Assert.Equal("$\"goo\"", SyntaxFactory.InterpolatedStringExpression( 22SyntaxFactory.Token(SyntaxKind.InterpolatedStringStartToken), 23SyntaxFactory.SingletonList<InterpolatedStringContentSyntax>( 24SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(
Parsing\InterpolationTests.cs (10)
14Assert.Equal("{a}", SyntaxFactory.Interpolation(SyntaxFactory.IdentifierName("a")).ToFullString()); 20Assert.Equal("{a,b:c}", SyntaxFactory.Interpolation( 21SyntaxFactory.IdentifierName("a"), 22SyntaxFactory.InterpolationAlignmentClause( 23SyntaxFactory.Token(SyntaxKind.CommaToken), 24SyntaxFactory.IdentifierName("b")), 25SyntaxFactory.InterpolationFormatClause( 26SyntaxFactory.Token(SyntaxKind.ColonToken), 27SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, "c", "c", default))).ToFullString());
Parsing\LambdaAttributeParsingTests.cs (2)
24return SyntaxFactory.ParseSyntaxTree(text, options: options); 29return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LambdaParameterParsingTests.cs (2)
22return SyntaxFactory.ParseSyntaxTree(text, options: options); 27return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LambdaReturnTypeParsingTests.cs (2)
18return SyntaxFactory.ParseSyntaxTree(text, options: options); 23return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LineSpanDirectiveParsingTests.cs (2)
20return SyntaxFactory.ParseSyntaxTree(text, options: options); 25return SyntaxFactory.ParseExpression(text, options: options);
Parsing\MemberDeclarationParsingTests.cs (4)
25return SyntaxFactory.ParseMemberDeclaration(text, offset, options); 77var d = SyntaxFactory.ParseMemberDeclaration(sb.ToString()); 103var cu = SyntaxFactory.ParseCompilationUnit(sb.ToString()); 144var d = SyntaxFactory.ParseMemberDeclaration("namespace ns {}", options: options);
Parsing\NameAttributeValueParsingTests.cs (1)
30var trivia = SyntaxFactory.ParseLeadingTrivia(commentText).Single();
Parsing\NameParsingTests.cs (4)
21return SyntaxFactory.ParseName(text); 26return SyntaxFactory.ParseTypeName(text); 779var tok = SyntaxFactory.ParseToken(text); 795var tok = SyntaxFactory.ParseToken(text);
Parsing\ParserErrorMessageTests.cs (53)
5439var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5442tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)); 5461var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5464tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5526var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5529tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5545var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5548tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5588var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5591tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5623var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5626tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5657var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5660tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)); 5694var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6)); 5946var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5964var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5977var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 5985tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)); 6006var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 6013tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)); 6036var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 6049tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)); 6078var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 6091tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)); 6148SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)).GetDiagnostics().Verify(); 6149SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6160SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6161SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6184SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6185SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6215SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)).GetDiagnostics().Verify(); 6216SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6243SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6244SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6271SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6272SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6285SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6286SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6304SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6305SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6328SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6329SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6348SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6349SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6365var tree = SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)); 6380SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6381SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6475SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6)).GetDiagnostics().Verify(); 6477SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)).GetDiagnostics().Verify(); 6579var expr = SyntaxFactory.ParseExpression(builder.ToString()); 6606var stmt = SyntaxFactory.ParseStatement(builder.ToString()); 6627SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Verify(
Parsing\ParserRegressionTests.cs (9)
25return SyntaxFactory.ParseSyntaxTree(text, options ?? TestOptions.Regular); 88var tree = SyntaxFactory.ParseSyntaxTree(test); 97var tree = SyntaxFactory.ParseSyntaxTree(test); 107var tree = SyntaxFactory.ParseSyntaxTree(test); 117var tree = SyntaxFactory.ParseSyntaxTree(test); 127var tree = SyntaxFactory.ParseSyntaxTree(test); 137var tree = SyntaxFactory.ParseSyntaxTree(test); 147var tree = SyntaxFactory.ParseSyntaxTree(test); 178SyntaxFactory.ParseExpression(code);
Parsing\ParsingErrorRecoveryTests.cs (25)
22return SyntaxFactory.ParseCompilationUnit(text, options: options); 7395SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text, TestOptions.Regular9); 7414SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7448SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7473SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7498SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7524SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7548SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7573SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7587SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(text); 7644var tree = SyntaxFactory.ParseSyntaxTree(source); 7671var tree = SyntaxFactory.ParseSyntaxTree(source); 7760var tree = SyntaxFactory.ParseSyntaxTree(source); 7775var tree = SyntaxFactory.ParseSyntaxTree(source); 7806var tree = SyntaxFactory.ParseSyntaxTree(source); 7840var tree = SyntaxFactory.ParseSyntaxTree(source); 7865var tree = SyntaxFactory.ParseSyntaxTree(source); 7892var tree = SyntaxFactory.ParseSyntaxTree(source); 7906var tree = SyntaxFactory.ParseSyntaxTree(source); 7918var tree = SyntaxFactory.ParseSyntaxTree(source); 7933var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7954var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7975var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7998var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 8022var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot();
Parsing\ParsingTests.cs (6)
78protected virtual SyntaxTree ParseTree(string text, CSharpParseOptions? options) => SyntaxFactory.ParseSyntaxTree(text, options); 81SyntaxFactory.ParseCompilationUnit(text, options: parseOptions); 96var node = SyntaxFactory.ParseStatement(text, options: options); 108var node = SyntaxFactory.ParseMemberDeclaration(text, offset, options, consumeFullText); 123UsingNode(text, SyntaxFactory.ParseExpression(text, options: options), expectedErrors); 365_ = SyntaxFactory.ParseSyntaxTree(stringBuilder.ToString(), TestOptions.RegularPreview);
Parsing\PatternParsingTests.cs (16)
229UsingNode(SyntaxFactory.ParseExpression("A is B < C, D > [ ]")); 274UsingNode(SyntaxFactory.ParseExpression("A < B > C")); 302SyntaxFactory.ParseExpression("e is A<B> && e").GetDiagnostics().Verify(); 303SyntaxFactory.ParseExpression("e is A<B> || e").GetDiagnostics().Verify(); 304SyntaxFactory.ParseExpression("e is A<B> ^ e").GetDiagnostics().Verify(); 305SyntaxFactory.ParseExpression("e is A<B> | e").GetDiagnostics().Verify(); 306SyntaxFactory.ParseExpression("e is A<B> & e").GetDiagnostics().Verify(); 307SyntaxFactory.ParseExpression("e is A<B>[]").GetDiagnostics().Verify(); 308SyntaxFactory.ParseExpression("new { X = e is A<B> }").GetDiagnostics().Verify(); 309SyntaxFactory.ParseExpression("e is A<B>").GetDiagnostics().Verify(); 311SyntaxFactory.ParseExpression("(item is Dictionary<string, object>[])").GetDiagnostics().Verify(); 312SyntaxFactory.ParseExpression("A is B < C, D > [ ]").GetDiagnostics().Verify(); 313SyntaxFactory.ParseExpression("A is B < C, D > [ ] E").GetDiagnostics().Verify(); 314SyntaxFactory.ParseExpression("A < B > C").GetDiagnostics().Verify(); 320SyntaxFactory.ParseExpression("from s in a where s is string where s.Length > 1 select s").GetDiagnostics().Verify(); 321SyntaxFactory.ParseExpression("M(out int? x)").GetDiagnostics().Verify();
Parsing\RawInterpolatedStringLiteralCompilingTests.cs (1)
63SyntaxFactory.ParseCompilationUnit(text[0..^i]);
Parsing\ReadOnlyStructs.cs (1)
23return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\RecordParsing.cs (1)
1217var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular8);
Parsing\RefReadonlyTests.cs (1)
23return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\RefStructs.cs (1)
23return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\RoundTrippingTests.cs (6)
28var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(text), options); 55var tree = SyntaxFactory.ParseSyntaxTree(text); 103var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(text), path: ""); 1582var tree = SyntaxFactory.ParseSyntaxTree(itext, options, ""); 1592var typeOfExpression = SyntaxFactory.ParseExpression(text, consumeFullText: true); 1596typeOfExpression = SyntaxFactory.ParseExpression(text, consumeFullText: false);
Parsing\ScriptParsingTests.cs (2)
25return SyntaxFactory.ParseSyntaxTree(text, options: options ?? TestOptions.Script); 9609var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Script);
Parsing\SeparatedSyntaxListParsingTests.cs (1)
24return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\SingleLineDeclarationParsingTests.cs (1)
25return SyntaxFactory.ParseSyntaxTree(text, options);
Parsing\StatementParsingTests.cs (7)
23return SyntaxFactory.ParseStatement(text, offset, options); 3360var tree = SyntaxFactory.ParseStatement(text); 3410var tree = SyntaxFactory.ParseSyntaxTree(text); 3437var tree = SyntaxFactory.ParseSyntaxTree(text, options: new CSharpParseOptions(documentationMode: DocumentationMode.Parse)); 3460var tree = SyntaxFactory.ParseSyntaxTree(source); 3506var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular); 3531var tree = SyntaxFactory.ParseSyntaxTree(source, options: TestOptions.Regular);
Parsing\SuppressNullableWarningExpressionParsingTests.cs (1)
23return SyntaxFactory.ParseExpression(text, options: options);
Parsing\TypeArgumentListParsingTests.cs (1)
17return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\UsingDirectiveParsingTests.cs (1)
18return SyntaxFactory.ParseSyntaxTree(text, options: options ?? TestOptions.RegularPreview);
Parsing\ValueTupleTests.cs (1)
22return SyntaxFactory.ParseSyntaxTree(text, options: options);
Parsing\VerbatimCrefParsingTests.cs (1)
29var trivia = SyntaxFactory.ParseLeadingTrivia(commentText).Single();
Syntax\ChildSyntaxListTests.cs (4)
20var node1 = SyntaxFactory.ReturnStatement(); 21var node2 = SyntaxFactory.ReturnStatement(); 30var node1 = SyntaxFactory.ReturnStatement(); 31var node2 = SyntaxFactory.ReturnStatement();
Syntax\GreenNodeTests.cs (9)
44var expression = SyntaxFactory.ParseExpression("x"); 45var sw1 = SyntaxFactory.SwitchStatement(expression); 48var sw2 = SyntaxFactory.SwitchStatement(expression, default); 56var expression = SyntaxFactory.ParseExpression("(x)"); 57var sw1 = SyntaxFactory.SwitchStatement(expression); 60var sw2 = SyntaxFactory.SwitchStatement(expression, default); 68var expression = SyntaxFactory.ParseExpression("(1, 2)"); 69var sw1 = SyntaxFactory.SwitchStatement(expression); 72var sw2 = SyntaxFactory.SwitchStatement(expression, default);
Syntax\LambdaUtilitiesTests.cs (47)
42var tree = SyntaxFactory.ParseSyntaxTree(source); 204SyntaxFactory.ParseExpression("F(1)"), 205SyntaxFactory.ParseExpression("F(1)"))); 208SyntaxFactory.ParseExpression("F(1)"), 209SyntaxFactory.ParseExpression("F(2)"))); 212SyntaxFactory.ParseExpression("F(a => 1)"), 213SyntaxFactory.ParseExpression("F(a => 2)"))); 216SyntaxFactory.ParseExpression("F(() => 1)"), 217SyntaxFactory.ParseExpression("F(() => 2)"))); 220SyntaxFactory.ParseExpression("F(delegate { return 1; })"), 221SyntaxFactory.ParseExpression("F(delegate { return 2; })"))); 224SyntaxFactory.ParseExpression("F(delegate (int a) { return 1; })"), 225SyntaxFactory.ParseExpression("F(delegate (bool a) { return 1; })"))); 228SyntaxFactory.ParseExpression("F(delegate (int a) { return 1; })"), 229SyntaxFactory.ParseExpression("F(delegate (int a) { return 2; })"))); 232SyntaxFactory.ParseExpression("F(() => { return 1; })"), 233SyntaxFactory.ParseExpression("F(() => { return 1; })"))); 236SyntaxFactory.ParseExpression("F(() => { return 1; })"), 237SyntaxFactory.ParseExpression("F((a) => { return 1; })"))); 240SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 241SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a + 1)"))); 244SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where a > 0 select a)"), 245SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where a > 0 select a + 1)"))); 248SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a select a)"), 249SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a select a + 1)"))); 252SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } let b = 1 select a)"), 253SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } let b = 1 select a + 1)"))); 256SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 257SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where b > 0 select a)"))); 260SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } from b in new[] { 3, 4 } where b > 0 select a)"), 261SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } from b in new[] { 3, 4, 5 } where b > 1 select a + 1)"))); 264SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"), 265SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4, 5 } on a equals b select a)"))); 268SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"), 269SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a + 1 equals b + 1 select a)"))); 272SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 273SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"))); 276SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 277SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a + 1 by a into g select g)"))); 280SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 281SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a + 1 into g select g)"))); 284SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 285SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into q select q)"))); 288SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a ascending select a)"), 289SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a + 1, a - 1 descending, a + 1 ascending select a)"))); 292SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a ascending select a)"), 293SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a descending select a)")));
Syntax\RedNodeTests.cs (1)
19return SyntaxFactory.MissingToken(token.Kind());
Syntax\SeparatedSyntaxListTests.cs (48)
22var node1 = SyntaxFactory.Parameter(SyntaxFactory.Identifier("a")); 23var node2 = SyntaxFactory.Parameter(SyntaxFactory.Identifier("b")); 52: SyntaxFactory.SeparatedList<ExpressionSyntax>(); 53var addList = list.Insert(0, SyntaxFactory.ParseExpression("x")); 56var insertBefore = addList.Insert(0, SyntaxFactory.ParseExpression("y")); 59var insertAfter = addList.Insert(1, SyntaxFactory.ParseExpression("y")); 62var insertBetween = insertAfter.InsertRange(1, new[] { SyntaxFactory.ParseExpression("a"), SyntaxFactory.ParseExpression("b"), SyntaxFactory.ParseExpression("c") }); 66var argsWithComment = SyntaxFactory.ParseArgumentList(@"(a, // a is good 69var insertAfterComment = argsWithComment.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 75var argsWithEOL = SyntaxFactory.ParseArgumentList(@"(a, 77var insertAfterEOL = argsWithEOL.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 82var argsWithMultiLineComment = SyntaxFactory.ParseArgumentList("(a, /* b is best */ b)").Arguments; 83var insertBeforeMultiLineComment = argsWithMultiLineComment.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 92SyntaxFactory.ParseExpression("A"), 93SyntaxFactory.ParseExpression("B"), 94SyntaxFactory.ParseExpression("C")] 95: SyntaxFactory.SeparatedList<SyntaxNode>( 97SyntaxFactory.ParseExpression("A"), 98SyntaxFactory.ParseExpression("B"), 99SyntaxFactory.ParseExpression("C") }); 115SyntaxNode nodeD = SyntaxFactory.ParseExpression("D"); 116SyntaxNode nodeE = SyntaxFactory.ParseExpression("E"); 235DoTestAddInsertRemoveOnEmptyList(SyntaxFactory.SeparatedList<SyntaxNode>()); 244SyntaxNode nodeD = SyntaxFactory.ParseExpression("D"); 245SyntaxNode nodeE = SyntaxFactory.ParseExpression("E"); 281var list = SyntaxFactory.SeparatedList<SyntaxNode>( 283SyntaxFactory.ParseExpression("A+B"), 284SyntaxFactory.IdentifierName("B"), 285SyntaxFactory.ParseExpression("1") }); 304? [SyntaxFactory.IdentifierName("A"), SyntaxFactory.IdentifierName("B"), SyntaxFactory.IdentifierName("C")] 305: SyntaxFactory.SeparatedList<SyntaxNode>( 307SyntaxFactory.IdentifierName("A"), 308SyntaxFactory.IdentifierName("B"), 309SyntaxFactory.IdentifierName("C"), 312var newComma = SyntaxFactory.Token( 313collectionExpression ? SyntaxFactory.TriviaList(SyntaxFactory.Space) : [SyntaxFactory.Space], 315collectionExpression ? SyntaxFactory.TriviaList() : []);
Syntax\StructuredTriviaTests.cs (26)
24var trivia1 = SyntaxFactory.Trivia(SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.IdentifierName(conditionName), false, false, false)); 35var spaceTrivia = SyntaxTriviaListBuilder.Create().Add(SyntaxFactory.Whitespace(" ")).ToList(); 39var xmlStartElement = SyntaxFactory.XmlElementStartTag( 40SyntaxFactory.Token(spaceTrivia, SyntaxKind.LessThanToken, default(SyntaxTriviaList)), 41SyntaxFactory.XmlName(null, 42SyntaxFactory.Identifier(name)), 44SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.GreaterThanToken, spaceTrivia)); 46var xmlEndElement = SyntaxFactory.XmlElementEndTag( 47SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), 48SyntaxFactory.XmlName(null, 49SyntaxFactory.Identifier(name)), 50SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.GreaterThanToken, spaceTrivia)); 52var xmlElement = SyntaxFactory.XmlElement(xmlStartElement, default(SyntaxList<XmlNodeSyntax>), xmlEndElement); 56var docComment = SyntaxFactory.DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia).WithContent(new SyntaxList<XmlNodeSyntax>(xmlElement)); 65var sTrivia = SyntaxFactory.Trivia(docComment); 67var ident = SyntaxFactory.Identifier(SyntaxTriviaList.Create(sTrivia), "banana", spaceTrivia); 74var identExpr = SyntaxFactory.IdentifierName(ident); 100var tree = SyntaxFactory.ParseSyntaxTree(@" 119var tree = SyntaxFactory.ParseSyntaxTree(@" 131var tree = SyntaxFactory.ParseSyntaxTree(@" 141var tree = SyntaxFactory.ParseSyntaxTree(@" 159var tree = SyntaxFactory.ParseSyntaxTree(@" 175var tree = SyntaxFactory.ParseSyntaxTree(@" 190var tree = SyntaxFactory.ParseSyntaxTree(" class goo {}");
Syntax\SyntaxAnnotationTests.cs (25)
25var tree = SyntaxFactory.ParseSyntaxTree(code); 53var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 62var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 63var toNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 72var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 80var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 89var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 90var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 99var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 109var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 118var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 133var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 143var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 156var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 188var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 220var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 252var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 271var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 280var tree = SyntaxFactory.ParseSyntaxTree(_helloWorldCode); 306var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 314var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 322var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 330var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 338var tree1 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); 339var tree2 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular);
Syntax\SyntaxDiffingTests.cs (22)
21var oldTree = SyntaxFactory.ParseSyntaxTree(""); 22var newTree = SyntaxFactory.ParseSyntaxTree("class C { }"); 40var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 41var newTree = SyntaxFactory.ParseSyntaxTree("class B { }"); 60var oldTree = SyntaxFactory.ParseSyntaxTree("class A { } class B { }"); 61var newTree = SyntaxFactory.ParseSyntaxTree("class C { } class D { }"); 84var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 102var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 120var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 139var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 159var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 177var oldTree = SyntaxFactory.ParseSyntaxTree("class A { }"); 195var oldTree = SyntaxFactory.ParseSyntaxTree("class A { int X; }"); 212var oldTree = SyntaxFactory.ParseSyntaxTree("namespace N { class A { int X; } }"); 229var oldTree = SyntaxFactory.ParseSyntaxTree("class A { int X; }"); 246var oldTree = SyntaxFactory.ParseSyntaxTree("namespace N { class A { int X; } }"); 283var oldTree = SyntaxFactory.ParseSyntaxTree(original); 313var newNode = SyntaxFactory.MemberAccessExpression( 315SyntaxFactory.ThisExpression(), 343var oldTree = SyntaxFactory.ParseSyntaxTree(original); 378var newNode = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ObjectKeyword))
Syntax\SyntaxEquivalenceTests.cs (122)
18Assert.True(SyntaxFactory.AreEquivalent(tree1, tree2, topLevel)); 21var tree3 = SyntaxFactory.ParseSyntaxTree(tree2.GetText().ToString()); 22Assert.True(SyntaxFactory.AreEquivalent(tree1, tree3, topLevel)); 27Assert.False(SyntaxFactory.AreEquivalent(tree1, tree2, topLevel)); 30var tree3 = SyntaxFactory.ParseSyntaxTree(tree2.GetText().ToString()); 31Assert.False(SyntaxFactory.AreEquivalent(tree1, tree3, topLevel)); 36Assert.True(SyntaxFactory.AreEquivalent(node1, node2, ignoreChildNode)); 39var tree3 = SyntaxFactory.ParseSyntaxTree(node2.GetText().ToString()); 40Assert.True(SyntaxFactory.AreEquivalent(node1, tree3.GetRoot(), ignoreChildNode)); 47var tree1 = SyntaxFactory.ParseSyntaxTree(text); 48var tree2 = SyntaxFactory.ParseSyntaxTree(text); 58var tree1 = SyntaxFactory.ParseSyntaxTree(text); 69var tree1 = SyntaxFactory.ParseSyntaxTree(text); 80var tree1 = SyntaxFactory.ParseSyntaxTree(text); 91var tree1 = SyntaxFactory.ParseSyntaxTree(text); 101var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { }"); 111var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { }"); 121var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int z = 0; } } }"); 131var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { }"); 141var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int z = 0; } } }"); 151var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { } }"); 161var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { } } }"); 171var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int i; } } }"); 181var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { int i = 5; int j = 6; } }"); 191var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { int i = 5; int j = 6; } }"); 201var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { int i = 5; } }"); 211var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { int i = 5, j = 7; } }"); 225var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { const int i = 5; } }"); 235var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { const int i = 5, j = 7; } }"); 250var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { const int i = 5; } } }"); 260var tree1 = SyntaxFactory.ParseSyntaxTree("enum E { i = 5 }"); 270var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { [Obsolete(true)]class C { const int i = 5; } }"); 280var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { Console.Write(0); } } }"); 290var tree1 = SyntaxFactory.ParseSyntaxTree("using System; namespace N { class C { void Goo() { Console.Write(0); } } }"); 300var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 310var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 320var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 330var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 340var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 350var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); 360var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); 370var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); 380var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); 390var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); 400var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); 411var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); 412var tree2 = SyntaxFactory.ParseSyntaxTree(text.Replace(" ", " /**/ ")); 422var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); 423var tree2 = SyntaxFactory.ParseSyntaxTree(text.Replace(" ", " ")); 433var tree1 = SyntaxFactory.ParseSyntaxTree(text); 434var tree2 = SyntaxFactory.ParseSyntaxTree(text.Replace("abc", "hello")); 442var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { Console.Write($\"Hello{123:N1}\"); } } }"); 457var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void M() => 1; }"); 458var tree2 = SyntaxFactory.ParseSyntaxTree("class C { void M() => 2; }"); 479var tree1 = SyntaxFactory.ParseSyntaxTree($@" 484var tree2 = SyntaxFactory.ParseSyntaxTree($@" 494var tree3 = SyntaxFactory.ParseSyntaxTree($@" 502var tree4 = SyntaxFactory.ParseSyntaxTree($@" 523var tree1 = SyntaxFactory.ParseSyntaxTree($@" 532var tree2 = SyntaxFactory.ParseSyntaxTree($@" 548var tree1 = SyntaxFactory.ParseSyntaxTree(@" 556var tree2 = SyntaxFactory.ParseSyntaxTree(@" 571var tree1 = SyntaxFactory.ParseSyntaxTree(@" 580var tree2 = SyntaxFactory.ParseSyntaxTree(@" 597var tree1 = SyntaxFactory.ParseSyntaxTree(@" 606var tree2 = SyntaxFactory.ParseSyntaxTree(@" 621var tree1 = SyntaxFactory.ParseSyntaxTree(@" 630var tree2 = SyntaxFactory.ParseSyntaxTree(@" 646var tree1 = SyntaxFactory.ParseSyntaxTree(@" 655var tree2 = SyntaxFactory.ParseSyntaxTree(@" 670var tree1 = SyntaxFactory.ParseSyntaxTree(@" 679var tree2 = SyntaxFactory.ParseSyntaxTree(@" 695var tree1 = SyntaxFactory.ParseSyntaxTree(@" 704var tree2 = SyntaxFactory.ParseSyntaxTree(@" 719var tree1 = SyntaxFactory.ParseSyntaxTree(@" 728var tree2 = SyntaxFactory.ParseSyntaxTree(@" 744var tree1 = SyntaxFactory.ParseSyntaxTree(@" 753var tree2 = SyntaxFactory.ParseSyntaxTree(@" 769var tree1 = SyntaxFactory.ParseSyntaxTree(@" 778var tree2 = SyntaxFactory.ParseSyntaxTree(@" 794var tree1 = SyntaxFactory.ParseSyntaxTree(@" 803var tree2 = SyntaxFactory.ParseSyntaxTree(@" 818var tree1 = SyntaxFactory.ParseSyntaxTree(@" 827var tree2 = SyntaxFactory.ParseSyntaxTree(@" 843var tree1 = SyntaxFactory.ParseSyntaxTree(@" 852var tree2 = SyntaxFactory.ParseSyntaxTree(@" 868var tree1 = SyntaxFactory.ParseSyntaxTree(@" 877var tree2 = SyntaxFactory.ParseSyntaxTree(@" 893var tree1 = SyntaxFactory.ParseSyntaxTree(@" 902var tree2 = SyntaxFactory.ParseSyntaxTree(@" 918var tree1 = SyntaxFactory.ParseSyntaxTree(@" 927var tree2 = SyntaxFactory.ParseSyntaxTree(@" 943var tree1 = SyntaxFactory.ParseSyntaxTree(@" 952var tree2 = SyntaxFactory.ParseSyntaxTree(@" 967var tree1 = SyntaxFactory.ParseSyntaxTree(@" 976var tree2 = SyntaxFactory.ParseSyntaxTree(@" 992var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1001var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1017var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1026var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1042var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1051var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1067var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1076var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1092var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1103var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1120var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1131var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1149var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1160var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1178var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1189var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1207var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1218var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1236var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1247var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1265var tree1 = SyntaxFactory.ParseSyntaxTree(@" 1276var tree2 = SyntaxFactory.ParseSyntaxTree(@" 1294var tree1 = SyntaxFactory.ParseSyntaxTree($$"""" 1304var tree2 = SyntaxFactory.ParseSyntaxTree($$"""" 1322var tree1 = SyntaxFactory.ParseSyntaxTree($$"""" 1332var tree2 = SyntaxFactory.ParseSyntaxTree($$""""
Syntax\SyntaxFactoryTests.cs (117)
25var token = SyntaxFactory.Token(SyntaxKind.InterpolatedVerbatimStringStartToken); 33var someValidName = SyntaxFactory.ParseName("System.String"); 34var usingDirective = SyntaxFactory.UsingDirective(SyntaxFactory.Token(SyntaxKind.StaticKeyword), null, someValidName); 45var text = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit(), encoding: null).GetText(); 53var text = SyntaxFactory.CompilationUnit().SyntaxTree.GetText(); 61var n = SyntaxFactory.NamespaceDeclaration(name: SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("goo"))); 81var c = SyntaxFactory.ClassDeclaration(identifier: SyntaxFactory.Identifier("goo")); 103Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(SyntaxKind.NumericLiteralExpression)); 111SyntaxFactory.ParseToken(string.Format("\"{0}\"", value)).WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithTrailingTrivia(SyntaxFactory.ElasticMarker); 112var t = SyntaxFactory.PragmaChecksumDirectiveTrivia(makeStringLiteral("file"), makeStringLiteral("guid"), makeStringLiteral("bytes"), true); 124SyntaxFactory.Token(SyntaxKind.IdentifierName); 134Assert.Throws(exceptionType, () => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierName, "text", "valueText", default(SyntaxTriviaList))); 141Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList))); 142Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList))); 143Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList))); 150SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList)); 156Assert.Contains(typeof(SyntaxFactory).ToString(), e.Message); // Make sure the class/namespace aren't updated without also updating the exception message 161SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList)); 167Assert.Contains(typeof(SyntaxFactory).ToString(), e.Message); // Make sure the class/namespace aren't updated without also updating the exception message 172SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList)); 178Assert.Contains(typeof(SyntaxFactory).ToString(), e.Message); // Make sure the class/namespace aren't updated without also updating the exception message 183SyntaxFactory.Identifier("text"); 184SyntaxFactory.Literal('c'); //character literal 185SyntaxFactory.Literal(123); //numeric literal 196var actualRed = SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker), kind, defaultText, defaultText, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)); 216var token = SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker), kind, text, valueText, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)); 236var null1 = SyntaxFactory.SeparatedList((ParameterSyntax[])null); 242var null2 = SyntaxFactory.SeparatedList((System.Collections.Generic.IEnumerable<VariableDeclaratorSyntax>)null); 248var empty1 = SyntaxFactory.SeparatedList(new TypeArgumentListSyntax[] { }); 254var empty2 = SyntaxFactory.SeparatedList(System.Linq.Enumerable.Empty<TypeParameterSyntax>()); 260var singleton1 = SyntaxFactory.SeparatedList(new[] { SyntaxFactory.IdentifierName("a") }); 266var singleton2 = SyntaxFactory.SeparatedList((System.Collections.Generic.IEnumerable<ExpressionSyntax>)new[] { SyntaxFactory.IdentifierName("x") }); 272var list1 = SyntaxFactory.SeparatedList(new[] { SyntaxFactory.IdentifierName("a"), SyntaxFactory.IdentifierName("b"), SyntaxFactory.IdentifierName("c") }); 279builder.Add(SyntaxFactory.Argument(SyntaxFactory.IdentifierName("x"))); 280builder.Add(SyntaxFactory.Argument(SyntaxFactory.IdentifierName("y"))); 281builder.Add(SyntaxFactory.Argument(SyntaxFactory.IdentifierName("z"))); 283var list2 = SyntaxFactory.SeparatedList<ArgumentSyntax>(builder); 376var literal = SyntaxFactory.Literal(3.14); 386var literal = SyntaxFactory.Literal("\u2028"); 394var literal = SyntaxFactory.Literal('\uDBFF'); 400var literal = SyntaxFactory.Literal(value); 420var tokens = SyntaxFactory.ParseTokens("1l").ToList(); 434var tokens = SyntaxFactory.ParseTokens("1L").ToList(); 448var expression = (LiteralExpressionSyntax)SyntaxFactory.ParseExpression("1l"); 462var expression = (LiteralExpressionSyntax)SyntaxFactory.ParseExpression("1L"); 486SyntaxFactory.CompilationUnit() 488SyntaxFactory.SingletonList<MemberDeclarationSyntax>( 489SyntaxFactory.ClassDeclaration("C") 491SyntaxFactory.SingletonList<MemberDeclarationSyntax>( 492SyntaxFactory.PropertyDeclaration( 493SyntaxFactory.NullableType( 494SyntaxFactory.PredefinedType( 495SyntaxFactory.Token(SyntaxKind.IntKeyword))), 496SyntaxFactory.Identifier("P")) 498SyntaxFactory.AccessorList()))))) 510SyntaxFactory.CompilationUnit() 512SyntaxFactory.SingletonList<MemberDeclarationSyntax>( 513SyntaxFactory.ClassDeclaration("C") 515SyntaxFactory.SingletonList<MemberDeclarationSyntax>( 516SyntaxFactory.PropertyDeclaration( 517SyntaxFactory.NullableType( 518SyntaxFactory.ParseTypeName("DateTime")), 519SyntaxFactory.Identifier("P")) 521SyntaxFactory.AccessorList()))))) 532var syntaxNode = SyntaxFactory.ParseExpression("x is int? y: z").NormalizeWhitespace(); 537var syntaxNode2 = SyntaxFactory.ParseExpression("x is DateTime? y: z").NormalizeWhitespace(); 547var syntaxNode = SyntaxFactory.ParseExpression("x is int??y").NormalizeWhitespace(); 550var syntaxNode2 = SyntaxFactory.ParseExpression("x is DateTime??y").NormalizeWhitespace(); 553var syntaxNode3 = SyntaxFactory.ParseExpression("x is object??y").NormalizeWhitespace(); 561var syntaxNode = SyntaxFactory.MethodDeclaration( 564returnType: SyntaxFactory.ParseTypeName("int[]"), 566identifier: SyntaxFactory.Identifier("M"), 568parameterList: SyntaxFactory.ParseParameterList("()"), 570body: (BlockSyntax)SyntaxFactory.ParseStatement("{}"), 571semicolonToken: SyntaxFactory.Token(SyntaxKind.SemicolonToken) 579var lambda = SyntaxFactory.ParenthesizedLambdaExpression(body: SyntaxFactory.Block()); 583var fullySpecified = SyntaxFactory.ParenthesizedLambdaExpression(parameterList: SyntaxFactory.ParameterList(), body: SyntaxFactory.Block()); 590var lambda = SyntaxFactory.ParenthesizedLambdaExpression(body: SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1))); 594var fullySpecified = SyntaxFactory.ParenthesizedLambdaExpression( 595parameterList: SyntaxFactory.ParameterList(), 596body: SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1))); 603var record = SyntaxFactory.RecordDeclaration( 604default, default, SyntaxFactory.Token(SyntaxKind.RecordKeyword), SyntaxFactory.Identifier("R"), null, null, null, default, default); 612var record = SyntaxFactory.RecordDeclaration( 613default, default, SyntaxFactory.Token(SyntaxKind.RecordKeyword), SyntaxFactory.Identifier("R"), null, null, null, default, 615? [SyntaxFactory.ParseMemberDeclaration("private int i;")] 616: SyntaxFactory.SingletonList(SyntaxFactory.ParseMemberDeclaration("private int i;"))); 626var parsedWith8 = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular8); 629var parsedWithPreview = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular9);
Syntax\SyntaxListTests.cs (30)
27var node1 = SyntaxFactory.ReturnStatement(); 28var node2 = SyntaxFactory.ReturnStatement(); 48SyntaxFactory.ParseExpression("A "), 49SyntaxFactory.ParseExpression("B "), 50SyntaxFactory.ParseExpression("C ")] 51: SyntaxFactory.List<SyntaxNode>( 53SyntaxFactory.ParseExpression("A "), 54SyntaxFactory.ParseExpression("B "), 55SyntaxFactory.ParseExpression("C ") }); 71SyntaxNode nodeD = SyntaxFactory.ParseExpression("D "); 72SyntaxNode nodeE = SyntaxFactory.ParseExpression("E "); 187DoTestAddInsertRemoveReplaceOnEmptyList(SyntaxFactory.List<SyntaxNode>()); 196SyntaxNode nodeD = SyntaxFactory.ParseExpression("D "); 197SyntaxNode nodeE = SyntaxFactory.ParseExpression("E "); 236var newMethodDeclaration = SyntaxFactory.MethodDeclaration(SyntaxFactory.ParseTypeName("void"), "M"); 243var declaration = SyntaxFactory.NamespaceDeclaration(SyntaxFactory.ParseName("M")); 250SyntaxFactory.AttributeList(collectionExpression 251? [SyntaxFactory.Attribute(SyntaxFactory.ParseName("Attr"))] 252: SyntaxFactory.SingletonSeparatedList( 253SyntaxFactory.Attribute(SyntaxFactory.ParseName("Attr")))), 259declaration = declaration.AddModifiers(SyntaxFactory.Token(SyntaxKind.PublicKeyword)); 268var list = SyntaxFactory.List<SyntaxNode>( 270SyntaxFactory.ParseExpression("A+B"), 271SyntaxFactory.IdentifierName("B"), 272SyntaxFactory.ParseExpression("1") }); 292var parsedArgumentList = SyntaxFactory.ParseArgumentList(commaSeparatedList);
Syntax\SyntaxNodeOrTokenListTests.cs (16)
21var node1 = SyntaxFactory.Parameter(SyntaxFactory.Identifier("a")); 22var node2 = SyntaxFactory.Parameter(SyntaxFactory.Identifier("b")); 41? [SyntaxFactory.ParseToken("A "), SyntaxFactory.ParseToken("B "), SyntaxFactory.ParseToken("C ")] 42: SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseToken("A "), SyntaxFactory.ParseToken("B "), SyntaxFactory.ParseToken("C ")); 58SyntaxNodeOrToken tokenD = SyntaxFactory.ParseToken("D "); 59SyntaxNodeOrToken nameE = SyntaxFactory.ParseExpression("E "); 176DoTestAddInsertRemoveReplaceOnEmptyList(SyntaxFactory.NodeOrTokenList()); 185SyntaxNodeOrToken tokenD = SyntaxFactory.ParseToken("D "); 186SyntaxNodeOrToken nodeE = SyntaxFactory.ParseExpression("E ");
Syntax\SyntaxNodeTests.cs (348)
45var tree = SyntaxFactory.ParseSyntaxTree(builder.ToString()); 54var qname = (QualifiedNameSyntax)SyntaxFactory.ParseName("A.B"); 55var qname2 = qname.WithRight(SyntaxFactory.IdentifierName("C")); 64var cls = SyntaxFactory.ParseCompilationUnit("class C { }").Members[0] as ClassDeclarationSyntax; 65var cls2 = cls.AddBaseListTypes(SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName("B"))); 72var expression = SyntaxFactory.ParseExpression(text); 84var expression = SyntaxFactory.ParseExpression(text); 102var expression = SyntaxFactory.ParseExpression(text); 121var expression = SyntaxFactory.ParseExpression(text); 133var statement = SyntaxFactory.ParseStatement(text); 179var statement = SyntaxFactory.ParseStatement(text); 233var statement = SyntaxFactory.ParseStatement(text); 268var statement = SyntaxFactory.ParseStatement(text); 306var cu = SyntaxFactory.ParseCompilationUnit(text); 317var expr = SyntaxFactory.ParseExpression(text); 334var expr = SyntaxFactory.ParseExpression(text); 351Assert.False(SyntaxFactory.ParseCompilationUnit("").ContainsDirective(kind)); 355Assert.False(SyntaxFactory.ParseCompilationUnit("namespace N { }").ContainsDirective(kind)); 360var compilationUnit = SyntaxFactory.ParseCompilationUnit("namespace N { } #if false"); 387testContainsHelper2(new[] { SyntaxKind.ShebangDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit("#!command", options: TestOptions.Script)); 388testContainsHelper2(new[] { SyntaxKind.BadDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit(" #!command", options: TestOptions.Script)); 389testContainsHelper2(new[] { SyntaxKind.BadDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit("#!command", options: TestOptions.Regular)); 398testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit(directive)); 401testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 407testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 413testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 421testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 430testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 439testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 454testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 486var compilationUnit = SyntaxFactory.ParseCompilationUnit(""" 513var expr = SyntaxFactory.ParseExpression(text); 534var t1 = SyntaxFactory.ParseSyntaxTree(s1); 547var t1 = SyntaxFactory.ParseSyntaxTree(s1); 560var t1 = SyntaxFactory.ParseSyntaxTree(s1); 577var t1 = SyntaxFactory.ParseSyntaxTree(s1); 589var t1 = SyntaxFactory.ParseSyntaxTree(s1); 601var t1 = SyntaxFactory.ParseSyntaxTree(s1); 614var t1 = SyntaxFactory.ParseSyntaxTree(s1); 627var expr = SyntaxFactory.ParseExpression(text); 644var expr = SyntaxFactory.ParseExpression(text); 661var t1 = SyntaxFactory.ParseSyntaxTree(s1); 672var tree = SyntaxFactory.ParseSyntaxTree(text); 684var identifier = SyntaxFactory.Identifier("x"); 685var missingIdentifier = SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken); 686var name = SyntaxFactory.IdentifierName(identifier); 687var missingName = SyntaxFactory.IdentifierName(missingIdentifier); 688var comma = SyntaxFactory.Token(SyntaxKind.CommaToken); 689var missingComma = SyntaxFactory.MissingToken(SyntaxKind.CommaToken); 690var argument = SyntaxFactory.Argument(name); 691var missingArgument = SyntaxFactory.Argument(missingName); 694var nodesAndTokens = SyntaxFactory.NodeOrTokenList( 705var argumentList = SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList<ArgumentSyntax>(collectionExpression 707: SyntaxFactory.NodeOrTokenList(nodesAndTokens))); 708var invocation = SyntaxFactory.InvocationExpression(name, argumentList); 726var tree = SyntaxFactory.ParseSyntaxTree(text); 786var tree = SyntaxFactory.ParseSyntaxTree(code); 801var tree = SyntaxFactory.ParseSyntaxTree(text); 809var tree = SyntaxFactory.ParseSyntaxTree(text); 817var tree1 = SyntaxFactory.ParseSyntaxTree(text); 818var tree2 = SyntaxFactory.ParseSyntaxTree(text); 826var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { }"); 827var tree2 = SyntaxFactory.ParseSyntaxTree("class bar { }"); 835var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { }"); 836var tree2 = SyntaxFactory.ParseSyntaxTree(string.Empty); 844var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { void M() { } }"); 845var tree2 = SyntaxFactory.ParseSyntaxTree("class bar { void M() { } }"); 857var tree1 = SyntaxFactory.ParseSyntaxTree("class goo {void M() { }}"); 858var tree2 = SyntaxFactory.ParseSyntaxTree("class goo { void M() { } }"); 866var tree = SyntaxFactory.ParseSyntaxTree(text); 874var tree = SyntaxFactory.ParseSyntaxTree(text); 882var tree = SyntaxFactory.ParseSyntaxTree(text); 890var tree1 = SyntaxFactory.ParseSyntaxTree(text); 891var tree2 = SyntaxFactory.ParseSyntaxTree(text); 899var tree1 = SyntaxFactory.ParseSyntaxTree(text); 900var tree2 = SyntaxFactory.ParseSyntaxTree(text); 908var tree1 = SyntaxFactory.ParseSyntaxTree(text); 919var tree1 = SyntaxFactory.ParseSyntaxTree(text); 929var tree = SyntaxFactory.ParseSyntaxTree(" class goo {}"); 944var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 952var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 960var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 968var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { "); 981var tree1 = SyntaxFactory.ParseSyntaxTree("class A {} public class B {} public static class C {}"); 1004var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1030var tree = SyntaxFactory.ParseSyntaxTree(text); 1055var tree = SyntaxFactory.ParseSyntaxTree( 1081SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1103var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1130var tree = SyntaxFactory.ParseSyntaxTree(text); 1160var tree = SyntaxFactory.ParseSyntaxTree(text); 1186SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1210var tree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); 1231SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); 1252var tree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); 1276SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); 1299var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1317var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1336var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); 1353var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); 1364var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); 1377var def = SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Identifier("GOO"), false); 1382var trivia = SyntaxFactory.Trivia(def); 1389var token = SyntaxFactory.Identifier(default(SyntaxTriviaList), "x", SyntaxTriviaList.Create(trivia)); 1400var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); 1409var tree = SyntaxFactory.ParseSyntaxTree( 1421var tree = SyntaxFactory.ParseSyntaxTree( 1449var tree = SyntaxFactory.ParseSyntaxTree( 1477var tree = SyntaxFactory.ParseSyntaxTree( 1505var tree = SyntaxFactory.ParseSyntaxTree( 1536var tree = SyntaxFactory.ParseSyntaxTree( 1575var tree = SyntaxFactory.ParseSyntaxTree( 1603var tree = SyntaxFactory.ParseSyntaxTree( 1637var tree = SyntaxFactory.ParseSyntaxTree( 1671var tree = SyntaxFactory.ParseSyntaxTree( 1702var tree = SyntaxFactory.ParseSyntaxTree( 1732var tree = SyntaxFactory.ParseSyntaxTree( 1752var tree = SyntaxFactory.ParseSyntaxTree( 1774var tree = SyntaxFactory.ParseSyntaxTree( 1790var tree = SyntaxFactory.ParseSyntaxTree( 1807var rootNode = SyntaxFactory.ParseSyntaxTree("using X; namespace Y { }").GetCompilationUnitRoot(); 1820SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree(@"class c1 1848var cc = SyntaxFactory.Token(SyntaxKind.ColonColonToken); 1849var lt = SyntaxFactory.Token(SyntaxKind.LessThanToken); 1850var gt = SyntaxFactory.Token(SyntaxKind.GreaterThanToken); 1851var dot = SyntaxFactory.Token(SyntaxKind.DotToken); 1853? [SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword))] 1854: SyntaxFactory.SingletonSeparatedList<TypeSyntax>(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword))); 1856var externAlias = SyntaxFactory.IdentifierName("alias"); 1857var goo = SyntaxFactory.IdentifierName("Goo"); 1858var bar = SyntaxFactory.IdentifierName("Bar"); 1861var qualified = SyntaxFactory.QualifiedName(goo, dot, bar); 1866var generic = SyntaxFactory.GenericName(bar.Identifier, SyntaxFactory.TypeArgumentList(lt, gp, gt)); 1871var qualifiedGeneric = SyntaxFactory.QualifiedName(goo, dot, generic); 1876var alias = SyntaxFactory.AliasQualifiedName(externAlias, cc, goo); 1881var aliasGeneric = SyntaxFactory.AliasQualifiedName(externAlias, cc, generic); 1886var aliasQualified = SyntaxFactory.QualifiedName(alias, dot, bar); 1891var aliasQualifiedGeneric = SyntaxFactory.QualifiedName(alias, dot, generic); 1899var someToken = SyntaxFactory.MissingToken(SyntaxKind.IntKeyword); 1902: SyntaxFactory.TokenList(someToken, someToken); 1910var missingComma = SyntaxFactory.MissingToken(SyntaxKind.CommaToken); 1911var omittedArraySize = SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 1912var spec = SyntaxFactory.ArrayRankSpecifier( 1913SyntaxFactory.Token(SyntaxKind.OpenBracketToken), 1914SyntaxFactory.SeparatedList<ExpressionSyntax>(new SyntaxNodeOrToken[] { omittedArraySize, missingComma, omittedArraySize, missingComma, omittedArraySize, missingComma, omittedArraySize }), 1915SyntaxFactory.Token(SyntaxKind.CloseBracketToken) 1938var zeroWidth = SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.MissingToken(SyntaxKind.HashToken), SyntaxFactory.MissingToken(SyntaxKind.ElseKeyword), SyntaxFactory.MissingToken(SyntaxKind.EndOfDirectiveToken), false, false); 1942var someToken = SyntaxFactory.Identifier( 1946? [SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth)] 1947: SyntaxFactory.TriviaList(SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth))); 1950var someNode = SyntaxFactory.IdentifierName(someToken); 1980var zeroWidth = SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.MissingToken(SyntaxKind.HashToken), SyntaxFactory.MissingToken(SyntaxKind.ElseKeyword), SyntaxFactory.MissingToken(SyntaxKind.EndOfDirectiveToken), false, false); 1984var someToken = SyntaxFactory.Identifier(default(SyntaxTriviaList), "", SyntaxFactory.TriviaList(SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth))); 1987var someNode = SyntaxFactory.IdentifierName(someToken); 2017var tree = SyntaxFactory.ParseSyntaxTree( 2032SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("class C {}"); 2053SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("class C {}"); 2073var tree = SyntaxFactory.ParseSyntaxTree("class C { void F() { } }"); 2102var expr = SyntaxFactory.ParseExpression("a + b"); 2104var expr2 = bex.ReplaceNode(bex.Right, SyntaxFactory.ParseExpression("c")); 2111var expr = SyntaxFactory.ParseExpression("a + b + c + d"); 2116(node, rewritten) => SyntaxFactory.ParenthesizedExpression(rewritten)); 2125var invocation = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression("m(a, b)"); 2126var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2127var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2149var ifstatement = (IfStatementSyntax)SyntaxFactory.ParseStatement("if (a < b) m(c)"); 2152var stat1 = SyntaxFactory.ParseStatement("m1(x)"); 2153var stat2 = SyntaxFactory.ParseStatement("m2(y)"); 2165var invocation = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression("m(a, b)"); 2166var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2167var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2189var ifstatement = (IfStatementSyntax)SyntaxFactory.ParseStatement("if (a < b) m(c)"); 2192var stat1 = SyntaxFactory.ParseStatement("m1(x)"); 2193var stat2 = SyntaxFactory.ParseStatement("m2(y)"); 2205var block = (BlockSyntax)SyntaxFactory.ParseStatement("{ var x = 10; var y = 20; }"); 2206var stmt1 = SyntaxFactory.ParseStatement("var z = 30; "); 2207var stmt2 = SyntaxFactory.ParseStatement("var q = 40; "); 2229var block = (BlockSyntax)SyntaxFactory.ParseStatement("{ var x = 10; var y = 20; }"); 2230var stmt1 = SyntaxFactory.ParseStatement("var z = 30; "); 2231var stmt2 = SyntaxFactory.ParseStatement("var q = 40; "); 2253var expr = SyntaxFactory.ParseExpression("a + b"); 2255var expr2 = expr.ReplaceToken(bToken, SyntaxFactory.ParseToken("c")); 2262var expr = SyntaxFactory.ParseExpression("a + b + c"); 2263var d = SyntaxFactory.ParseToken("d "); 2272var cu = SyntaxFactory.ParseCompilationUnit("private class C { }"); 2274var publicToken = SyntaxFactory.ParseToken("public "); 2275var partialToken = SyntaxFactory.ParseToken("partial "); 2290var cu = SyntaxFactory.ParseCompilationUnit("private class C { }"); 2293var identifierA = SyntaxFactory.ParseToken("A"); 2294var identifierB = SyntaxFactory.ParseToken("B"); 2306var cu = SyntaxFactory.ParseCompilationUnit("public class C { }"); 2308var partialToken = SyntaxFactory.ParseToken("partial "); 2309var staticToken = SyntaxFactory.ParseToken("static "); 2321var cu = SyntaxFactory.ParseCompilationUnit("public class C { }"); 2324var identifierA = SyntaxFactory.ParseToken("A"); 2325var identifierB = SyntaxFactory.ParseToken("B"); 2338var expr = SyntaxFactory.ParseStatement(text); 2342var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(token.Kind())); 2352var expr = SyntaxFactory.ParseStatement(text); 2357var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace("garbage")), token.Kind(), default(SyntaxTriviaList))); 2367var cu = SyntaxFactory.ParseCompilationUnit(text); 2370var cu2 = cu.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace(" ")), token.Kind(), default(SyntaxTriviaList))); 2379var expr = SyntaxFactory.ParseExpression("#if true\r\na + \r\n#endif\r\n + b"); 2385var twoSpace = SyntaxFactory.Whitespace(" "); 2394var expr = SyntaxFactory.ParseExpression("a + b"); 2396var twoSpaces = SyntaxFactory.Whitespace(" "); 2404var expr = SyntaxFactory.ParseExpression("a + b"); 2405var twoSpaces = SyntaxFactory.Whitespace(" "); 2414var ex = SyntaxFactory.ParseExpression("/* c */ identifier"); 2420var newComment1 = SyntaxFactory.ParseLeadingTrivia("/* a */")[0]; 2421var newComment2 = SyntaxFactory.ParseLeadingTrivia("/* b */")[0]; 2436var ex = SyntaxFactory.ParseExpression("/* c */ identifier"); 2442var newComment1 = SyntaxFactory.ParseLeadingTrivia("/* a */")[0]; 2443var newComment2 = SyntaxFactory.ParseLeadingTrivia("/* b */")[0]; 2455var id = SyntaxFactory.ParseToken("a "); 2457var twoSpace = SyntaxFactory.Whitespace(" "); 2465var id = SyntaxFactory.ParseToken("a // goo\r\n"); 2468var id2 = id.ReplaceTrivia(id.GetAllTrivia(), (tr, tr2) => SyntaxFactory.Space); 2477var expr = SyntaxFactory.ParseExpression("m(a, b, /* trivia */ c)"); 2491var expr = SyntaxFactory.ParseExpression(@"m(a, b, /* trivia */ 2507var expr = SyntaxFactory.ParseExpression(@"m(a, b, 2523var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, 2541var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a 2565var expr = SyntaxFactory.ParseExpression("m(a, b, /* trivia */ c)"); 2579var expr = SyntaxFactory.ParseExpression( 2595var expr = SyntaxFactory.ParseExpression( 2611var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, 2628var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a 2650var expr = SyntaxFactory.ParseExpression("m(/* before */ a /* after */)"); 2664var expr = SyntaxFactory.ParseExpression("m(/* before */ a /* after */, b, c)"); 2678var expr = SyntaxFactory.ParseExpression("m(a, b, /* before */ c /* after */)"); 2692var expr = SyntaxFactory.ParseStatement("{ a; b; /* trivia */ c }"); 2706var expr = SyntaxFactory.ParseStatement("{ a; b; /* trivia */ c }"); 2723var cu = SyntaxFactory.ParseCompilationUnit("class C { void M() { } /* trivia */ }"); 2739var cu = SyntaxFactory.ParseCompilationUnit(@" 2919var cu = SyntaxFactory.ParseCompilationUnit(@"class A { } class B { } // test"); 2935var cu = SyntaxFactory.ParseCompilationUnit(@"class A { } class B { } #endregion"); 2951var cu = SyntaxFactory.ParseCompilationUnit(@" 3096var cu = SyntaxFactory.ParseCompilationUnit(@" 3263var cu = SyntaxFactory.ParseCompilationUnit(@" 3328var tree = SyntaxFactory.ParseSyntaxTree(s1); 3390var syntaxTree = SyntaxFactory.ParseSyntaxTree(@"namespace n1 { c1<t"); 3402var syntaxTree = SyntaxFactory.ParseSyntaxTree(@" 3440var syntaxTree = SyntaxFactory.ParseSyntaxTree(code); 3459var tree = SyntaxFactory.ParseSyntaxTree(code); 3474var tree = SyntaxFactory.ParseSyntaxTree(code); 3494var tree = SyntaxFactory.ParseSyntaxTree(@" 3504var newModifiers = method.Modifiers.Add(SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.UnsafeKeyword, SyntaxFactory.TriviaList(SyntaxFactory.Space))); 3514var intType = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword)); 3515var commaToken = SyntaxFactory.Token(SyntaxKind.CommaToken); 3517SyntaxFactory.SingletonSeparatedList<TypeSyntax>(intType); 3518SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken }); 3519SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType }); 3520SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType, commaToken }); 3522Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken })); 3523Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken })); 3524Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, intType })); 3531var node = SyntaxFactory.ParseCompilationUnit(" "); 3542var node = SyntaxFactory.ParseSyntaxTree(" ").GetCompilationUnitRoot(); 3553var root = SyntaxFactory.ParseCompilationUnit(text); 3585var root = SyntaxFactory.ParseCompilationUnit(text); 3599var emptyWhitespace = SyntaxFactory.Whitespace(""); 3600var emptyToken = SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken).WithTrailingTrivia(emptyWhitespace, emptyWhitespace); 3601var emptyTokenList = SyntaxFactory.TokenList(emptyToken, emptyToken); 3610var emptyTriviaList = SyntaxFactory.TriviaList(emptyWhitespace, emptyWhitespace); 3627var treeFromSource_invalid2 = SyntaxFactory.ParseSyntaxTree(st); 3648SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(SourceText); 3660NameSyntax name = SyntaxFactory.QualifiedName(SyntaxFactory.IdentifierName("System"), SyntaxFactory.IdentifierName("Collections.Generic")); 3698SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(SourceText); 3731SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(SourceText); 3751var idToken = SyntaxFactory.Identifier("goo"); 3760idToken = SyntaxFactory.ParseToken("x"); 3767idToken = SyntaxFactory.ParseToken(" x "); 3776SyntaxNode namedNode = SyntaxFactory.IdentifierName("goo"); 3785namedNode = SyntaxFactory.ParseExpression("goo"); 3792namedNode = SyntaxFactory.ParseExpression(" goo "); 3801SyntaxNodeOrToken nodeOrToken = SyntaxFactory.Identifier("goo"); 3810nodeOrToken = SyntaxFactory.IdentifierName("goo"); 3819nodeOrToken = SyntaxFactory.ParseToken("goo"); 3826nodeOrToken = SyntaxFactory.ParseExpression("goo"); 3833nodeOrToken = SyntaxFactory.ParseToken(" goo "); 3842nodeOrToken = SyntaxFactory.ParseExpression(" goo "); 3869var tree = SyntaxFactory.ParseSyntaxTree(code.ToString()); 3879var expression = SyntaxFactory.ParseExpression(text); 3893var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3894var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3902var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3903var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3911var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3912var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3920var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3921var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3929var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3930var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3938var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3939var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3947var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3956var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3965var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3974var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3983var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3992var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 4001var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 4002var newAsync = SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space); 4011var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 4030action(SyntaxFactory.ParseCompilationUnit(test.Key), test.Value); 4039var expression = (StackAllocArrayCreationExpressionSyntax)SyntaxFactory.ParseExpression(text); 4040var replacedKeyword = SyntaxFactory.Token(SyntaxKind.StackAllocKeyword).WithTrailingTrivia(SyntaxFactory.Space); 4050var parameter = SyntaxFactory.ParseParameterList(text).Parameters[0];
Syntax\SyntaxNormalizerTests.cs (42)
412var node = SyntaxFactory.ParseExpression(text.NormalizeLineEndings()); 941var node = SyntaxFactory.ParseStatement(text.NormalizeLineEndings()); 3408var node = SyntaxFactory.ParseCompilationUnit(text.NormalizeLineEndings()); 3554var token = SyntaxFactory.ParseToken(text.NormalizeLineEndings()); 3564SyntaxFactory.DefineDirectiveTrivia( 3565SyntaxFactory.Identifier("a"), false), """ 3596SyntaxFactory.TriviaList( 3597SyntaxFactory.Trivia( 3598SyntaxFactory.IfDirectiveTrivia( 3599SyntaxFactory.IdentifierName("a"), false, false, false)), 3600SyntaxFactory.Trivia( 3601SyntaxFactory.EndIfDirectiveTrivia(false))), """ 3634SyntaxFactory.TriviaList( 3635SyntaxFactory.Trivia( 3636SyntaxFactory.LineDirectiveTrivia( 3637SyntaxFactory.Literal(1), 3640SyntaxFactory.Token( 3641SyntaxFactory.TriviaList( 3642SyntaxFactory.Trivia( 3643SyntaxFactory.SkippedTokensTrivia() 3644.WithTokens([SyntaxFactory.Literal(@"""a\b""")]))), 3658SyntaxFactory.LineSpanDirectiveTrivia( 3659SyntaxFactory.Token(SyntaxKind.HashToken), 3660SyntaxFactory.Token(SyntaxKind.LineKeyword), 3661SyntaxFactory.LineDirectivePosition(SyntaxFactory.Literal(1), SyntaxFactory.Literal(2)), 3662SyntaxFactory.Token(SyntaxKind.MinusToken), 3663SyntaxFactory.LineDirectivePosition(SyntaxFactory.Literal(3), SyntaxFactory.Literal(4)), 3664SyntaxFactory.Literal(5), 3665SyntaxFactory.Literal("a.txt"), 3666SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), 3722var tree = SyntaxFactory.ParseSyntaxTree(code); 3750var tree = SyntaxFactory.ParseSyntaxTree(code); 3779var tree = SyntaxFactory.ParseSyntaxTree(code); 3798var actual = SyntaxFactory.ParseCompilationUnit(code).NormalizeWhitespace(indentation: " ", eol: "\n").ToFullString(); 3814var actual = SyntaxFactory.ParseCompilationUnit(code).NormalizeWhitespace(indentation: " ").ToFullString(); 3986var list = SyntaxFactory.ParseLeadingTrivia(text.NormalizeLineEndings()); 5966var syntaxNode = SyntaxFactory.ParseStatement(expression).NormalizeWhitespace(); 5979var syntaxNode = SyntaxFactory.ParseExpression(expression).NormalizeWhitespace();
Syntax\SyntaxRewriterTests.cs (46)
314var node = SyntaxFactory.ClassDeclaration("Class1"); 323var node1 = SyntaxFactory.ParseCompilationUnit("class Class1<T> { }"); 327var node2 = SyntaxFactory.ParseExpression("2 + 2"); 336var tree = SyntaxFactory.ParseSyntaxTree("class Class1<T> { }"); 339var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(tokenT, SyntaxFactory.Identifier("U")); 348var tree = SyntaxFactory.ParseSyntaxTree("class Class1 : Class2<T> { }"); 351var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(typeName, SyntaxFactory.ParseTypeName("Class2<U>")); 361var tree = SyntaxFactory.ParseSyntaxTree("System.Console.Write(\"Before\")", TestOptions.Script); 364var after = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal("After")); 376var tree = SyntaxFactory.ParseSyntaxTree("m(a, b)", TestOptions.Script); 379var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 380var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 395var tree = SyntaxFactory.ParseSyntaxTree("m(a, b)", TestOptions.Script); 398var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 399var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 422var tree = SyntaxFactory.ParseSyntaxTree("private class C { }", options: TestOptions.Script); 427var publicToken = SyntaxFactory.ParseToken("public "); 428var partialToken = SyntaxFactory.ParseToken("partial "); 442var tree = SyntaxFactory.ParseSyntaxTree("public class C { }", options: TestOptions.Script); 445var partialToken = SyntaxFactory.ParseToken("partial "); 446var staticToken = SyntaxFactory.ParseToken("static "); 465var tree = SyntaxFactory.ParseSyntaxTree("/* c */ identifier", options: TestOptions.Script); 472var newComment1 = SyntaxFactory.ParseLeadingTrivia("/* a */")[0]; 473var newComment2 = SyntaxFactory.ParseLeadingTrivia("/* b */")[0]; 492var tree = SyntaxFactory.ParseSyntaxTree("/* c */ identifier", options: TestOptions.Script); 499var newComment1 = SyntaxFactory.ParseLeadingTrivia("/* a */")[0]; 500var newComment2 = SyntaxFactory.ParseLeadingTrivia("/* b */")[0]; 514var tree = SyntaxFactory.ParseSyntaxTree("private class C { }", options: TestOptions.Script); 527var tree = SyntaxFactory.ParseSyntaxTree("private class C { }", options: TestOptions.Script); 539var tree = SyntaxFactory.ParseSyntaxTree("class Class1<T> { }"); 553var ifStmt1 = (IfStatementSyntax)SyntaxFactory.ParseStatement("if (true)"); 567var trivia = SyntaxFactory.ParseTrailingTrivia(" "); 600var tree1 = SyntaxFactory.ParseSyntaxTree("class C { static void Main() { if (true) } }"); 613var trivia = SyntaxFactory.ParseTrailingTrivia(" "); 670var root = SyntaxFactory.ParseCompilationUnit(text); 695var red = isExpr ? (CSharpSyntaxNode)SyntaxFactory.ParseExpression(input) : SyntaxFactory.ParseStatement(input); 708var red = isExpr ? (CSharpSyntaxNode)SyntaxFactory.ParseExpression(input) : SyntaxFactory.ParseStatement(input); 794return SyntaxFactory.ClassDeclaration(SyntaxFactory.Identifier("class"));
Syntax\SyntaxTests.cs (10)
22Assert.False(SyntaxFactory.IsCompleteSubmission(SyntaxFactory.ParseSyntaxTree(code, options: TestOptions.Script))); 27Assert.True(SyntaxFactory.IsCompleteSubmission(SyntaxFactory.ParseSyntaxTree(code, options: TestOptions.Script))); 33Assert.Throws<ArgumentNullException>(() => SyntaxFactory.IsCompleteSubmission(null)); 35SyntaxFactory.IsCompleteSubmission(SyntaxFactory.ParseSyntaxTree("", options: TestOptions.Regular))); 157var t = SyntaxFactory.AccessorDeclaration(SyntaxKind.UnknownAccessorDeclaration); 163var section = SyntaxFactory.SwitchSection(); 182var expr = SyntaxFactory.ParseExpression(source, options: TestOptions.Regular);
Syntax\SyntaxTokenListTests.cs (18)
21var node1 = SyntaxFactory.ReturnStatement(); 37var node1 = SyntaxFactory.ReturnStatement(); 63? [SyntaxFactory.ParseToken("A "), SyntaxFactory.ParseToken("B "), SyntaxFactory.ParseToken("C ")] 64: SyntaxFactory.TokenList(SyntaxFactory.ParseToken("A "), SyntaxFactory.ParseToken("B "), SyntaxFactory.ParseToken("C ")); 80var tokenD = SyntaxFactory.ParseToken("D "); 81var tokenE = SyntaxFactory.ParseToken("E "); 196DoTestAddInsertRemoveReplaceOnEmptyList(SyntaxFactory.TokenList()); 205var tokenD = SyntaxFactory.ParseToken("D "); 206var tokenE = SyntaxFactory.ParseToken("E "); 244var list = SyntaxFactory.TokenList( 245SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), 246SyntaxFactory.Literal("x"), 247SyntaxFactory.Token(SyntaxKind.DotToken));
Syntax\SyntaxTreeTests.cs (21)
81var root = SyntaxFactory.ParseCompilationUnit(source, options: parseOptions); 90SyntaxTreeFactoryKind.ParsedTreeWithRootAndOptions => WithInitializedDirectives(SyntaxFactory.ParseSyntaxTree("", options: parseOptions)).WithRootAndOptions(root, parseOptions), 119var root = SyntaxFactory.ParseCompilationUnit(""); 131var tree = CSharpSyntaxTree.Create(SyntaxFactory.ParseCompilationUnit(""), options: null, path: null, encoding: null, diagnosticOptions: options); 201var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit()); 209var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit()); 219var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit()); 230var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit()); 243var oldTree = SyntaxFactory.ParseSyntaxTree("class B {}"); 244var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); 260var oldTree = SyntaxFactory.ParseSyntaxTree(oldText); 262var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); 277var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); 287var oldTree = SyntaxFactory.ParseSyntaxTree("class B {}", path: "old.cs"); 302var oldTree = SyntaxFactory.ParseSyntaxTree(oldText, path: "old.cs"); 329oldTree = SyntaxFactory.ParseSyntaxTree("", path: "old.cs"); 331Assert.Equal(string.Empty, SyntaxFactory.ParseSyntaxTree("", path: null).FilePath);
Syntax\SyntaxTriviaListTests.cs (11)
21var node1 = SyntaxFactory.Token(SyntaxKind.AbstractKeyword); 22var node2 = SyntaxFactory.Token(SyntaxKind.VirtualKeyword); 37var node1 = SyntaxFactory.Token(SyntaxKind.AbstractKeyword); 38var node2 = SyntaxFactory.Token(SyntaxKind.VirtualKeyword); 53var list = SyntaxFactory.ParseLeadingTrivia("/*A*//*B*//*C*/"); 69var triviaD = SyntaxFactory.ParseLeadingTrivia("/*D*/")[0]; 70var triviaE = SyntaxFactory.ParseLeadingTrivia("/*E*/")[0]; 185DoTestAddInsertRemoveReplaceOnEmptyList(SyntaxFactory.ParseLeadingTrivia("/*A*/").RemoveAt(0)); 193var triviaD = SyntaxFactory.ParseLeadingTrivia("/*D*/")[0]; 194var triviaE = SyntaxFactory.ParseLeadingTrivia("/*E*/")[0]; 232var list = SyntaxFactory.ParseLeadingTrivia("/*A*//*B*//*C*/");
Syntax\TrackNodeTests.cs (18)
23var expr = SyntaxFactory.ParseExpression("a + b"); 34var expr = SyntaxFactory.ParseExpression("a + b"); 46var expr = SyntaxFactory.ParseExpression("a + b"); 55var expr = SyntaxFactory.ParseExpression("a + b"); 65var expr = SyntaxFactory.ParseExpression("a + b"); 69var newA = currentA.WithLeadingTrivia(SyntaxFactory.Comment("/* ayup */")); 80var expr = SyntaxFactory.ParseExpression("a + b"); 84var newA = currentA.WithLeadingTrivia(SyntaxFactory.Comment("/* ayup */")); 96var expr = SyntaxFactory.ParseExpression("a + b"); 100var replacedExpr = trackedExpr.ReplaceNode(currentA, SyntaxFactory.IdentifierName("c")); 108var expr = SyntaxFactory.ParseExpression("a + b"); 112var replacedExpr = trackedExpr.ReplaceNode(currentA, SyntaxFactory.IdentifierName("c")); 121var expr = SyntaxFactory.ParseExpression("a + b"); 133var expr = SyntaxFactory.ParseExpression("a + b"); 148var expr = SyntaxFactory.ParseExpression("a + b + c"); 166var expr = SyntaxFactory.ParseExpression("a + b + c"); 183var expr = SyntaxFactory.ParseExpression("a + b"); 184Assert.Throws<ArgumentException>(() => expr.TrackNodes(SyntaxFactory.IdentifierName("c")));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CSharpTestSource.cs (1)
42var tree = SyntaxFactory.ParseSyntaxTree(stringText, options ?? TestOptions.RegularPreview, path);
DiagnosticTestUtilities.cs (1)
67select SyntaxFactory.ParseSyntaxTree(SourceText.From(text, encoding: null, SourceHashAlgorithms.Default))).ToArray();
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (3)
PdbTests.cs (3)
76new[] { SyntaxFactory.ParseSyntaxTree("class C { static void Main() {} }") }, 92new[] { SyntaxFactory.ParseSyntaxTree("class C { static void Main() {} }") }, 109new[] { SyntaxFactory.ParseSyntaxTree("class C { static void Main() {} }") },
Microsoft.CodeAnalysis.CSharp.Workspaces (380)
Classification\ClassificationHelpers.cs (2)
501var tokens = SyntaxFactory.ParseTokens(text2, initialTokenPosition: textSpan.Start); 530var token = SyntaxFactory.ParseToken(text);
Classification\Worker.cs (1)
285foreach (var token in SyntaxFactory.ParseTokens(text: trivia.ToFullString(), initialTokenPosition: trivia.SpanStart))
CodeGeneration\CSharpSyntaxGenerator.cs (220)
35SyntaxFactory.IdentifierName(SyntaxFactory.ParseToken("nameof")); 43internal override SyntaxTrivia ElasticMarker => SyntaxFactory.ElasticMarker; 49=> SyntaxFactory.Whitespace(text); 52=> SyntaxFactory.SeparatedList<TElement>(list); 59? SyntaxFactory.Token(default, SyntaxKind.InterpolatedVerbatimStringStartToken, InterpolatedVerbatimText, InterpolatedVerbatimText, default) 67=> SyntaxFactory.SeparatedList(nodes, separators); 73return SyntaxFactory.Trivia(structuredTriviaSyntax); 81var docTrivia = SyntaxFactory.DocumentationCommentTrivia( 83(SyntaxList<XmlNodeSyntax>)SyntaxFactory.List(nodes), 86docTrivia = docTrivia.WithLeadingTrivia(SyntaxFactory.DocumentationCommentExterior("/// ")) 89return docTrivia.WithTrailingTrivia(SyntaxFactory.EndOfLine(endOfLineString)); 96return SyntaxFactory.DocumentationCommentTrivia(documentationCommentTrivia.Kind(), (SyntaxList<XmlNodeSyntax>)SyntaxFactory.List(content), documentationCommentTrivia.EndOfComment); 107return SyntaxFactory.CompilationUnit() 156=> SyntaxFactory.UsingDirective((NameSyntax)name); 159=> SyntaxFactory.UsingDirective(SyntaxFactory.NameEquals(aliasIdentifierName), (NameSyntax)name); 163return SyntaxFactory.NamespaceDeclaration( 180return SyntaxFactory.FieldDeclaration( 183SyntaxFactory.VariableDeclaration( 185[SyntaxFactory.VariableDeclarator( 188initializer != null ? SyntaxFactory.EqualsValueClause((ExpressionSyntax)initializer) : null)])); 199return SyntaxFactory.Parameter( 204initializer != null ? SyntaxFactory.EqualsValueClause((ExpressionSyntax)initializer) : null); 241return SyntaxFactory.MethodDeclaration( 246returnType: returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 273var returnTypeNode = returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword); 283return SyntaxFactory.ConversionOperatorDeclaration( 293return SyntaxFactory.OperatorDeclaration( 298operatorToken: SyntaxFactory.Token(GetOperatorSyntaxKind(operatorName)), 350? SyntaxFactory.ParameterList([.. parameters.Cast<ParameterSyntax>()]) 351: SyntaxFactory.ParameterList(); 362return SyntaxFactory.ConstructorDeclaration( 367baseConstructorArguments != null ? SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, SyntaxFactory.ArgumentList([.. baseConstructorArguments.Select(AsArgument)])) : null, 372=> SyntaxFactory.DestructorDeclaration(destructorMethod.ContainingType.Name).WithBody(SyntaxFactory.Block()); 411return SyntaxFactory.PropertyDeclaration( 417SyntaxFactory.AccessorList([.. accessors])); 429var accessor = SyntaxFactory.AccessorDeclaration(kind); 456var list = SyntaxFactory.List(accessorDeclarations.Cast<AccessorDeclarationSyntax>()); 458? SyntaxFactory.AccessorList(list) 500return SyntaxFactory.IndexerDeclaration( 506SyntaxFactory.AccessorList([.. accessors])); 512? SyntaxFactory.BracketedParameterList([.. parameters.Cast<ParameterSyntax>()]) 513: SyntaxFactory.BracketedParameterList(); 518var ad = SyntaxFactory.AccessorDeclaration( 536return SyntaxFactory.EventFieldDeclaration( 539SyntaxFactory.VariableDeclaration( 541[SyntaxFactory.VariableDeclarator(name)])); 568return SyntaxFactory.EventDeclaration( 574SyntaxFactory.AccessorList([.. accessors])); 606return WithInterfaceSpecifier(d, SyntaxFactory.ExplicitInterfaceSpecifier((NameSyntax)interfaceTypeName)); 706baseTypes.Add(SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)); 709baseTypes.AddRange(interfaceTypes.Select(i => SyntaxFactory.SimpleBaseType((TypeSyntax)i))); 716var baseTypeList = baseTypes.Count > 0 ? SyntaxFactory.BaseList([.. baseTypes]) : null; 720? SyntaxFactory.RecordDeclaration(default, modifierList, RecordKeyword, nameToken, typeParameterList, null, baseTypeList, default, typeMembers) 721: SyntaxFactory.ClassDeclaration(default, modifierList, nameToken, typeParameterList, baseTypeList, default, typeMembers); 757var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 763var baseTypeList = itypes?.Count > 0 ? SyntaxFactory.BaseList([.. itypes]) : null; 767? SyntaxFactory.RecordDeclaration(default, modifierList, RecordKeyword, nameToken, typeParameterList, null, baseTypeList, default, structMembers).WithClassOrStructKeyword(StructKeyword) 768: SyntaxFactory.StructDeclaration(default, modifierList, nameToken, typeParameterList, baseTypeList, default, structMembers); 778var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 784return SyntaxFactory.InterfaceDeclaration( 789itypes != null ? SyntaxFactory.BaseList([.. itypes]) : null, 827var modifiersToken = SyntaxFactory.TokenList(abstractVirtualModifiers); 887return SyntaxFactory.EnumDeclaration( 891underlyingType != null ? SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)underlyingType)]) : null, 897return SyntaxFactory.EnumMemberDeclaration( 900expression != null ? SyntaxFactory.EqualsValueClause((ExpressionSyntax)expression) : null); 936return SyntaxFactory.DelegateDeclaration( 939returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 947=> AsAttributeList(SyntaxFactory.Attribute((NameSyntax)name, AsAttributeArgumentList(attributeArguments))); 952? SyntaxFactory.AttributeArgument(SyntaxFactory.NameEquals(name.ToIdentifierName()), nameColon: null, (ExpressionSyntax)expression) 953: SyntaxFactory.AttributeArgument((ExpressionSyntax)expression); 957=> arguments != null ? SyntaxFactory.AttributeArgumentList([.. arguments.Select(AsAttributeArgument)]) : null; 963return SyntaxFactory.AttributeArgument(expr); 968return SyntaxFactory.AttributeArgument(null, arg.NameColon, arg.Expression); 979return node.WithLeadingTrivia(SyntaxFactory.ElasticMarker) 980.WithTrailingTrivia(SyntaxFactory.ElasticMarker); 995return node is AttributeSyntax attr ? SyntaxFactory.AttributeList([attr]) : (AttributeListSyntax)node; 1089.Select(list => list.WithTarget(SyntaxFactory.AttributeTargetSpecifier(ReturnKeyword))); 1094return [.. attributes.Select(list => list.WithTarget(SyntaxFactory.AttributeTargetSpecifier(AssemblyKeyword)))]; 1713list[i] = list[i].WithTrailingTrivia(SyntaxFactory.ElasticSpace); 1726=> SyntaxFactory.TypeParameter(name); 1730return SyntaxFactory.TypeParameter( 1738SyntaxFactory.Identifier(typeParameter.Name)); 1744? SyntaxFactory.TypeParameterList([.. typeParameterNodes.Cast<TypeParameterSyntax>()]) 1785method.ParameterList.GetTrailingTrivia().Add(SyntaxFactory.ElasticMarker).AddRange(method.ConstraintClauses.Last().GetTrailingTrivia()))); 1804=> SyntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceImplementations[0].ContainingType.GenerateNameSyntax()); 1819return method.AddConstraintClauses(SyntaxFactory.TypeParameterConstraintClause( 1820typeParameterName).AddConstraints(SyntaxFactory.DefaultConstraint())); 1831? SyntaxFactory.SeparatedList<TypeParameterConstraintSyntax>(types.Select(t => SyntaxFactory.TypeConstraint((TypeSyntax)t))) 1836constraints = constraints.Add(SyntaxFactory.ConstructorConstraint()); 1844constraints = constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(isReferenceType ? SyntaxKind.ClassConstraint : SyntaxKind.StructConstraint)); 1848constraints = constraints.Insert(0, SyntaxFactory.TypeConstraint(SyntaxFactory.IdentifierName("unmanaged"))); 1857return clauses.Add(SyntaxFactory.TypeParameterConstraintClause(typeParameterName.ToIdentifierName(), constraints)); 2137? SyntaxFactory.BracketedParameterList() 2138: SyntaxFactory.ParameterList(); 2196return SyntaxFactory.Token(token.Kind()).WithTriviaFrom(rewrittenToken); 2234return SyntaxFactory.ParenthesizedLambdaExpression(AsParameterList(parameters), lambda.Body) 2366return WithEqualsValue(declaration, SyntaxFactory.EqualsValueClause(expr)); 2517currentList = SyntaxFactory.AccessorList(); 2549=> SyntaxFactory.AccessorList([.. nodes.Select(n => AsAccessor(n, parentKind)).WhereNotNull()]); 2657return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(0, SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)))); 2661return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)])); 2671return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(baseList.Types.Count, SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)))); 2675return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)])); 2785return SyntaxFactory.AreEquivalent(fd1.Modifiers, fd2.Modifiers) 2786&& SyntaxFactory.AreEquivalent(fd1.AttributeLists, fd2.AttributeLists); 2791return SyntaxFactory.AreEquivalent(efd1.Modifiers, efd2.Modifiers) 2792&& SyntaxFactory.AreEquivalent(efd1.AttributeLists, efd2.AttributeLists); 2797return SyntaxFactory.AreEquivalent(ld1.Modifiers, ld2.Modifiers); 2806return SyntaxFactory.AreEquivalent(vd1.Type, vd2.Type) && AreSimilarExceptForSubDeclarations(vd1.Parent, vd2.Parent); 2825newNodes.Add(this.WithSubDeclarationsRemoved(multiPartDeclaration, index, count - index).WithTrailingTrivia(SyntaxFactory.ElasticSpace)); 2833newNodes.Add(this.WithSubDeclarationsRemoved(multiPartDeclaration, 0, index + 1).WithLeadingTrivia(SyntaxFactory.ElasticSpace)); 2850newDeclarations = newDeclarations.Select(declaration => declaration is StatementSyntax statement ? SyntaxFactory.GlobalStatement(statement) : declaration); 2889newDeclarations = newDeclarations.Select(declaration => declaration is StatementSyntax statement ? SyntaxFactory.GlobalStatement(statement) : declaration); 2928this.WithSubDeclarationsRemoved(multiPartDeclaration, index, count - index).WithTrailingTrivia(SyntaxFactory.ElasticSpace) 2931newNodes.Add(this.WithSubDeclarationsRemoved(multiPartDeclaration, 0, index).WithLeadingTrivia(SyntaxFactory.ElasticSpace)); 3062=> SyntaxFactory.AssignmentExpression(SyntaxKind.AddAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)Parenthesize(handler)); 3065=> SyntaxFactory.AssignmentExpression(SyntaxKind.SubtractAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)Parenthesize(handler)); 3068=> SyntaxFactory.AwaitExpression((ExpressionSyntax)expression); 3074=> SyntaxFactory.ReturnStatement((ExpressionSyntax?)expression); 3077=> SyntaxFactory.ThrowStatement((ExpressionSyntax?)expression); 3080=> SyntaxFactory.ThrowExpression((ExpressionSyntax)expression); 3086return SyntaxFactory.IfStatement( 3095return SyntaxFactory.IfStatement( 3098SyntaxFactory.ElseClause( 3108var block = existingBlock ?? SyntaxFactory.Block(); 3128return SyntaxFactory.ExpressionStatement(expression); 3135=> SyntaxFactory.ExpressionStatement((ExpressionSyntax)expression); 3142return SyntaxFactory.MemberAccessExpression( 3155=> SyntaxFactory.ElementBindingExpression( 3156SyntaxFactory.BracketedArgumentList([.. arguments.Cast<ArgumentSyntax>()])); 3184var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, [SyntaxFactory.ArrayRankSpecifier([(ExpressionSyntax)size])]); 3185return SyntaxFactory.ArrayCreationExpression(arrayType); 3190var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, 3191[SyntaxFactory.ArrayRankSpecifier([SyntaxFactory.OmittedArraySizeExpression()])]); 3192var initializer = SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, AsExpressionList(elements)); 3193return SyntaxFactory.ArrayCreationExpression(arrayType, initializer); 3197=> SyntaxFactory.ObjectCreationExpression((TypeSyntax)type, CreateArgumentList(arguments), null); 3200=> SyntaxFactory.ObjectCreationExpression( 3202SyntaxFactory.ArgumentList(openParen, (SeparatedSyntaxList<ArgumentSyntax>)arguments, closeParen), 3206=> SyntaxFactory.ArgumentList(CreateArguments(arguments)); 3212=> argOrExpression as ArgumentSyntax ?? SyntaxFactory.Argument((ExpressionSyntax)argOrExpression); 3215=> SyntaxFactory.InvocationExpression(ParenthesizeLeft((ExpressionSyntax)expression), CreateArgumentList(arguments)); 3218=> SyntaxFactory.ElementAccessExpression(ParenthesizeLeft((ExpressionSyntax)expression), SyntaxFactory.BracketedArgumentList(CreateArguments(arguments))); 3221=> SyntaxFactory.Literal(text, value); 3224=> SyntaxFactory.DefaultExpression((TypeSyntax)type).WithAdditionalAnnotations(Simplifier.Annotation); 3235return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 3241return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 3253return SyntaxFactory.LiteralExpression( 3254SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 3265=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)Parenthesize(expression), (TypeSyntax)type); 3268=> SyntaxFactory.TypeOfExpression((TypeSyntax)type); 3271=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)Parenthesize(expression), (TypeSyntax)type); 3274=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)Parenthesize(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 3277=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)Parenthesize(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 3280=> SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, (ExpressionSyntax)left, (ExpressionSyntax)Parenthesize(right)); 3283=> SyntaxFactory.BinaryExpression(syntaxKind, (ExpressionSyntax)Parenthesize(left), (ExpressionSyntax)Parenthesize(right)); 3310=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, (ExpressionSyntax)Parenthesize(expression)); 3334=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.BitwiseNotExpression, (ExpressionSyntax)Parenthesize(operand)); 3343=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, (ExpressionSyntax)Parenthesize(expression)); 3346=> SyntaxFactory.ConditionalExpression((ExpressionSyntax)Parenthesize(condition), (ExpressionSyntax)Parenthesize(whenTrue), (ExpressionSyntax)Parenthesize(whenFalse)); 3352=> SyntaxFactory.ThisExpression(); 3355=> SyntaxFactory.BaseExpression(); 3370=> SyntaxFactory.GenericName(identifier, 3371SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3379return SyntaxFactory.GenericName(sname.Identifier, SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3383return gname.WithTypeArgumentList(SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3404=> SyntaxFactory.QualifiedName((NameSyntax)left, (SimpleNameSyntax)right).WithAdditionalAnnotations(Simplifier.Annotation); 3407=> SyntaxFactory.AliasQualifiedName( 3408SyntaxFactory.IdentifierName(GlobalKeyword), 3419RefKind.Ref => SyntaxFactory.RefType(type), 3420RefKind.RefReadOnly => SyntaxFactory.RefType(RefKeyword, ReadOnlyKeyword, type), 3426=> SyntaxFactory.PredefinedType(specialType switch 3447=> SyntaxFactory.ArrayType((TypeSyntax)type, [SyntaxFactory.ArrayRankSpecifier()]); 3457return SyntaxFactory.NullableType((TypeSyntax)type); 3462=> SyntaxFactory.TupleType([.. elements.Cast<TupleElementSyntax>()]); 3465=> SyntaxFactory.TupleElement((TypeSyntax)type, name?.ToIdentifierToken() ?? default); 3469return SyntaxFactory.Argument( 3470name == null ? null : SyntaxFactory.NameColon(name), 3480return SyntaxFactory.UsingStatement( 3488return SyntaxFactory.UsingStatement( 3496return SyntaxFactory.LockStatement( 3503return SyntaxFactory.TryStatement( 3506finallyStatements != null ? SyntaxFactory.FinallyClause(CreateBlock(finallyStatements)) : null); 3511return SyntaxFactory.CatchClause( 3512SyntaxFactory.CatchDeclaration((TypeSyntax)type, name.ToIdentifierToken()), 3518=> SyntaxFactory.WhileStatement((ExpressionSyntax)condition, CreateBlock(statements)); 3524return SyntaxFactory.SwitchStatement( 3530return SyntaxFactory.SwitchStatement( 3542=> SyntaxFactory.SwitchSection(AsSwitchLabels(expressions), AsStatementList(statements)); 3546return SyntaxFactory.SwitchSection( 3552=> SyntaxFactory.SwitchSection([SyntaxFactory.DefaultSwitchLabel()], AsStatementList(statements)); 3560labels = labels.AddRange(expressions.Select(e => SyntaxFactory.CaseSwitchLabel((ExpressionSyntax)e))); 3567=> SyntaxFactory.BreakStatement(); 3570=> SyntaxFactory.Block(statements.Cast<StatementSyntax>()); 3573=> SyntaxFactory.GlobalStatement((StatementSyntax)statement); 3580? SyntaxFactory.SimpleLambdaExpression(parameter, (CSharpSyntaxNode)expression) 3581: SyntaxFactory.ParenthesizedLambdaExpression(AsParameterList(parameters), (CSharpSyntaxNode)expression); 3600=> SyntaxFactory.IdentifierName(identifier); 3604return SyntaxFactory.AnonymousObjectMemberDeclarator( 3605SyntaxFactory.NameEquals((IdentifierNameSyntax)identifier), 3610=> SyntaxFactory.TupleExpression([.. arguments.Select(AsArgument)]); 3653=> SyntaxFactory.ParseExpression(stringToParse);
Rename\CSharpRenameRewriterLanguageService.cs (9)
603var parsedIdentifier = SyntaxFactory.ParseName(currentNewIdentifier); 615? newToken.CopyAnnotationsTo(SyntaxFactory.VerbatimIdentifier(newToken.LeadingTrivia, currentNewIdentifier, valueText, newToken.TrailingTrivia)) 616: newToken.CopyAnnotationsTo(SyntaxFactory.Identifier(newToken.LeadingTrivia, SyntaxKind.IdentifierToken, currentNewIdentifier, valueText, newToken.TrailingTrivia)); 670var newTrivia = SyntaxFactory.Comment(replacedString); 692newToken = RenameInStringLiteral(oldToken, newToken, subSpansToReplace, SyntaxFactory.Literal); 697SyntaxFactory.Token(newToken.LeadingTrivia, SyntaxKind.InterpolatedStringTextToken, text, value, newToken.TrailingTrivia)); 705newToken = RenameInStringLiteral(oldToken, newToken, subSpansToReplace, SyntaxFactory.XmlTextLiteral); 709var newIdentifierToken = SyntaxFactory.Identifier(newToken.LeadingTrivia, _replacementText, newToken.TrailingTrivia); 1125var name = SyntaxFactory.ParseName(replacementText);
Simplification\CSharpSimplificationService.cs (2)
130SyntaxFactory.VerbatimIdentifier( 166tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(Formatter.Annotation);
Simplification\CSharpSimplificationService.Expander.cs (1)
27using static SyntaxFactory;
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (2)
61var reparsedAncestor = SyntaxFactory.ParseExpression(reducedAncestor.ToFullString()); 64return SyntaxFactory.ParenthesizedExpression(reducedNode)
Simplification\Reducers\CSharpDefaultExpressionReducer.Rewriter.cs (1)
37return SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
Simplification\Reducers\CSharpEscapingReducer.cs (2)
140? originalToken.CopyAnnotationsTo(SyntaxFactory.VerbatimIdentifier(originalToken.LeadingTrivia, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia)) 141: originalToken.CopyAnnotationsTo(SyntaxFactory.Identifier(originalToken.LeadingTrivia, SyntaxKind.IdentifierToken, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia));
Simplification\Reducers\CSharpExtensionMethodReducer.cs (5)
77newMemberAccess = SyntaxFactory.MemberAccessExpression( 84newMemberAccess = SyntaxFactory.MemberAccessExpression( 90newMemberAccess = SyntaxFactory.MemberAccessExpression( 109var newArguments = SyntaxFactory.SeparatedList<ArgumentSyntax>(argumentList.Arguments.GetWithSeparators().AsEnumerable().Skip(2)); 112var candidateRewrittenNode = SyntaxFactory.InvocationExpression(newMemberAccess, rewrittenArgumentList);
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
98var newSimpleLambda = SyntaxFactory.SimpleLambdaExpression(
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
47return SyntaxFactory.IdentifierName("var")
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (6)
61return SyntaxFactory.Token(kind); 64return SyntaxFactory.Identifier(specialType == SpecialType.System_IntPtr ? "nint" : "nuint"); 121var aliasIdentifier = SyntaxFactory.IdentifierName(aliasName); 282var aliasIdentifier = SyntaxFactory.IdentifierName(aliasName); 374? SyntaxFactory.IdentifierName(token) 375: SyntaxFactory.PredefinedType(token);
Simplification\Simplifiers\ExpressionSimplifier.cs (2)
152replacementNode = SyntaxFactory.IdentifierName( 153memberAccess.Name.Identifier.CopyAnnotationsTo(SyntaxFactory.Identifier(
Simplification\Simplifiers\NameSimplifier.cs (1)
23using static SyntaxFactory;
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (1)
14using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (1)
7using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (1)
18return [SyntaxFactory.Token(argument.RefKindKeyword.Kind())];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (1)
27block = SyntaxFactory.Block(statement);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
95var parsed = SyntaxFactory.ParseStatement(nextTrivia.ToFullString()); 131arrowExpression = SyntaxFactory.ArrowExpressionClause(expression); 206expression = SyntaxFactory.ThrowExpression(throwStatement.ThrowKeyword, throwStatement.Expression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (1)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
877return SyntaxFactory.ThrowStatement(throwExpression.ThrowKeyword, throwExpression.Expression, semicolonToken); 883return SyntaxFactory.ReturnStatement(expression.WithLeadingTrivia(SyntaxFactory.ElasticSpace)) 886.WithPrependedLeadingTrivia(SyntaxFactory.ElasticMarker); 890return SyntaxFactory.ReturnStatement(expression) 896return SyntaxFactory.ExpressionStatement(expression)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
107var expr = SyntaxFactory.GetStandaloneExpression(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (5)
34token = token.WithLeadingTrivia(SyntaxFactory.ElasticSpace); 38token = token.WithLeadingTrivia(SyntaxFactory.Space); 46token = token.WithTrailingTrivia(SyntaxFactory.ElasticSpace); 50token = token.WithTrailingTrivia(SyntaxFactory.Space); 65token = SyntaxFactory.Token(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
239var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
142=> SyntaxFactory.ParseLeadingTrivia(s ?? string.Empty); 185yield return SyntaxFactory.ElasticMarker;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (5)
50=> SyntaxFactory.Whitespace(text); 56_newLine = SyntaxFactory.EndOfLine(Context.Options.NewLine); 224var multilineCommentTrivia = SyntaxFactory.ParseLeadingTrivia(multiLineComment); 338var formattedTrivia = SyntaxFactory.Trivia((StructuredTriviaSyntax)result.GetFormattedRoot(cancellationToken)); 372var formattedTrivia = SyntaxFactory.Trivia((StructuredTriviaSyntax)result.GetFormattedRoot(cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
57var parsedNewTrivia = SyntaxFactory.DocumentationCommentExterior(newTriviaText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (3)
91var trailingTrivia = SyntaxFactory.ParseTrailingTrivia(text); 94var leadingTrivia = SyntaxFactory.ParseLeadingTrivia(text[width..]); 147return SyntaxFactory.ParseLeadingTrivia(text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (1)
23? SyntaxFactory.Comment(text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (9)
41=> SyntaxFactory.ElasticMarker; 44=> SyntaxFactory.ElasticCarriageReturnLineFeed; 80=> SyntaxFactory.ParseToken(text); 83=> SyntaxFactory.ParseLeadingTrivia(text); 175=> node is ExpressionSyntax expression ? SyntaxFactory.GetStandaloneExpression(expression) : node; 467var token = SyntaxFactory.ParseToken(identifier); 473var token = SyntaxFactory.ParseToken(identifier); 1350=> SyntaxFactory.AreEquivalent(token1, token2); 1353=> SyntaxFactory.AreEquivalent(node1, node2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
103var candidateReplacementNode = SyntaxFactory.IdentifierName("var"); 193SyntaxFactory.IdentifierName("var").WithTriviaFrom(declarationTypeNode).WithAdditionalAnnotations(annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ArgumentGenerator.cs (3)
17return SyntaxFactory.Argument(expression); 24=> SyntaxFactory.ArgumentList([.. arguments.Select(GenerateArgument)]); 27=> SyntaxFactory.BracketedArgumentList([.. arguments.Select(GenerateArgument)]);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
18using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
19using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (1)
17using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
23using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
26using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (1)
17using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
22using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (1)
20using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (1)
19using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
16using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
22using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
20return SyntaxFactory.Block(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (1)
14using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
14using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (1)
13using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
21using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
12using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
18using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\QueryExpressionSyntaxExtensions.cs (1)
44var clauses = SyntaxFactory.List(allClauses.Take(allClauses.Count() - 1).Cast<QueryClauseSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (2)
28: SyntaxFactory.SeparatedList<T>(newList.GetWithSeparators().Add(SyntaxFactory.Token(separator)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (3)
39return SyntaxFactory.Identifier(escaped); 46var token = SyntaxFactory.Identifier( 58=> SyntaxFactory.IdentifierName(identifier.ToIdentifierToken());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
102var leadingTrivia = prependNewLineIfMissing ? token.LeadingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.LeadingTrivia; 103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 104return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(Formatter.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
84=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
25using static SyntaxFactory;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (38)
34=> SyntaxFactory.CarriageReturnLineFeed; 37=> SyntaxFactory.ElasticCarriageReturnLineFeed; 46=> SyntaxFactory.EndOfLine(text); 49=> SyntaxFactory.Comment("//" + text); 53return SyntaxFactory.LocalDeclarationStatement( 62=> SyntaxFactory.EqualsValueClause(operatorToken, (ExpressionSyntax)value); 66return SyntaxFactory.VariableDeclaration( 67type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 68[SyntaxFactory.VariableDeclarator( 70expression == null ? null : SyntaxFactory.EqualsValueClause((ExpressionSyntax)expression))]); 74=> SyntaxFactory.Identifier(identifier); 77=> SyntaxFactory.ConditionalAccessExpression((ExpressionSyntax)expression, (ExpressionSyntax)whenNotNull); 80=> SyntaxFactory.MemberBindingExpression((SimpleNameSyntax)name); 83=> SyntaxFactory.RefExpression((ExpressionSyntax)expression); 97=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 106=> SyntaxFactory.InterpolatedStringExpression(startToken, [.. content.Cast<InterpolatedStringContentSyntax>()], endToken); 109=> SyntaxFactory.InterpolatedStringText(textToken); 112=> SyntaxFactory.Token( 119=> SyntaxFactory.Interpolation((ExpressionSyntax)syntaxNode); 122=> SyntaxFactory.InterpolationAlignmentClause(CommaToken, (ExpressionSyntax)alignment); 125=> SyntaxFactory.InterpolationFormatClause( 127SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 130=> SyntaxFactory.TypeParameterList([.. typeParameterNames.Select(SyntaxFactory.TypeParameter)]); 175return SyntaxFactory.TokenList(result); 198=> SyntaxFactory.IsPatternExpression( 204=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)Parenthesize(left), (PatternSyntax)Parenthesize(right)); 207=> SyntaxFactory.ConstantPattern((ExpressionSyntax)expression); 210=> SyntaxFactory.DeclarationPattern( 212SyntaxFactory.SingleVariableDesignation(name.ToIdentifierToken())); 215=> SyntaxFactory.RelationalPattern(LessThanToken, (ExpressionSyntax)expression); 218=> SyntaxFactory.RelationalPattern(LessThanEqualsToken, (ExpressionSyntax)expression); 221=> SyntaxFactory.RelationalPattern(GreaterThanToken, (ExpressionSyntax)expression); 224=> SyntaxFactory.RelationalPattern(GreaterThanEqualsToken, (ExpressionSyntax)expression); 227=> SyntaxFactory.UnaryPattern(NotKeyword, (PatternSyntax)Parenthesize(pattern)); 230=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)Parenthesize(left), (PatternSyntax)Parenthesize(right)); 236=> SyntaxFactory.TypePattern((TypeSyntax)type); 239=> SyntaxFactory.UnaryPattern(operatorToken, (PatternSyntax)Parenthesize(pattern));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
27using static SyntaxFactory; 276.AddAccessorListAccessors(SyntaxFactory
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (2)
49SyntaxFactory.VerbatimIdentifier( 85tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(Formatter.Annotation);
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.cs (1)
67return SyntaxFactory.ParseSyntaxTree(text, options, filePath, cancellationToken: cancellationToken);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (25)
CodeGeneration\AddAttributesTests.cs (1)
19using static SyntaxFactory;
CodeGeneration\SyntaxGeneratorTests.cs (2)
24using static SyntaxFactory; 974var comp = CSharpCompilation.Create(null, [SyntaxFactory.ParseSyntaxTree("""
CSharpSyntaxFactsServiceTests.cs (1)
18var tree = SyntaxFactory.ParseSyntaxTree(code);
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (2)
26var parsedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(statement, options: options); 121var tree = SyntaxFactory.ParseSyntaxTree(text);
Formatting\CSharpFormattingTestBase.cs (1)
21=> SyntaxFactory.ParseCompilationUnit(text, options: (CSharpParseOptions?)parseOptions);
Formatting\FormattingElasticTriviaTests.cs (1)
20using static SyntaxFactory;
Formatting\FormattingTests.cs (12)
4639var property = SyntaxFactory.PropertyDeclaration( 4642SyntaxFactory.ParseTypeName("int"), 4644SyntaxFactory.Identifier("Prop"), 4645SyntaxFactory.AccessorList([ 4646SyntaxFactory.AccessorDeclaration( 4648SyntaxFactory.Block(SyntaxFactory.ParseStatement("return c;"))), 4649SyntaxFactory.AccessorDeclaration( 4651SyntaxFactory.Block(SyntaxFactory.ParseStatement("c = value;")))])); 8278var block = SyntaxFactory.Block(); 9319=> Formatter.Format(SyntaxFactory.StructDeclaration("S"), DefaultWorkspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Formatting\FormattingTriviaTests.cs (5)
1742var tree = SyntaxFactory.ParseCompilationUnit("class C\r\n{\r\n}"); 1745tree = tree.ReplaceTrivia(tree.DescendantTrivia().Where(tr => tr.IsKind(SyntaxKind.EndOfLineTrivia)), (o, r) => SyntaxFactory.ElasticMarker); 1783var tree = SyntaxFactory.ParseCompilationUnit(code); 1787.Where(tr => tr.IsKind(SyntaxKind.EndOfDirectiveToken)), (o, r) => o.WithTrailingTrivia(o.LeadingTrivia.Add(SyntaxFactory.ElasticEndOfLine(newLine))) 1788.WithLeadingTrivia(SyntaxFactory.TriviaList())
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
ChangeSignature\AddedParameterOrExistingIndex.cs (1)
68LanguageNames.CSharp => semanticModel.GetSpeculativeTypeInfo(0, CSharp.SyntaxFactory.ParseTypeName(_addedParameterFullyQualifiedTypeName!), SpeculativeBindingOption.BindAsTypeOrNamespace).Type,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (19)
CodeGeneration\CodeGenerationTests.cs (12)
731yield return CS.SyntaxFactory.Token(CS.SyntaxKind.AbstractKeyword); 736yield return CS.SyntaxFactory.Token(CS.SyntaxKind.AsyncKeyword); 741yield return CS.SyntaxFactory.Token(CS.SyntaxKind.ConstKeyword); 746yield return CS.SyntaxFactory.Token(CS.SyntaxKind.NewKeyword); 751yield return CS.SyntaxFactory.Token(CS.SyntaxKind.OverrideKeyword); 756yield return CS.SyntaxFactory.Token(CS.SyntaxKind.PartialKeyword); 761yield return CS.SyntaxFactory.Token(CS.SyntaxKind.ReadOnlyKeyword); 766yield return CS.SyntaxFactory.Token(CS.SyntaxKind.SealedKeyword); 771yield return CS.SyntaxFactory.Token(CS.SyntaxKind.StaticKeyword); 776yield return CS.SyntaxFactory.Token(CS.SyntaxKind.UnsafeKeyword); 781yield return CS.SyntaxFactory.Token(CS.SyntaxKind.VirtualKeyword); 941list.Add(CS.SyntaxFactory.ParseStatement(p + delimiter));
CodeGeneration\CodeGenerationTests.CSharp.cs (2)
153thisArguments: ImmutableArray.Create<SyntaxNode>(CS.SyntaxFactory.ParseExpression("42"))); 1404var eol = SyntaxFactory.EndOfLine(@"");
Utilities\SymbolEquivalenceComparerTests.cs (5)
1739var a1 = (Compilation)CS.CSharpCompilation.Create("a", [CS.SyntaxFactory.ParseSyntaxTree(source)], references, CSharpDllOptions); 1740var a2 = (Compilation)CS.CSharpCompilation.Create("a", [CS.SyntaxFactory.ParseSyntaxTree(source)], references, CSharpDllOptions); 1742var b1 = (Compilation)CS.CSharpCompilation.Create("b", [CS.SyntaxFactory.ParseSyntaxTree(sourceV1)], references, CSharpSignedDllOptions); 1743var b2 = (Compilation)CS.CSharpCompilation.Create("b", [CS.SyntaxFactory.ParseSyntaxTree(sourceV2)], references, CSharpSignedDllOptions); 1744var b3 = (Compilation)CS.CSharpCompilation.Create("b", [CS.SyntaxFactory.ParseSyntaxTree(sourceV2)], references, CSharpSignedDllOptions);
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\ActiveStatementTestHelpers.cs (1)
42static (source, path) => SyntaxFactory.ParseSyntaxTree(SourceText.From(source, encoding: Encoding.UTF8, SourceHashAlgorithms.Default), path: path),
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
276return SyntaxFactory.ParseSyntaxTree(sourceText, parseOptions, source.filePath);
Microsoft.CodeAnalysis.Features.UnitTests (4)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (3)
68var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.Path); 69var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.Path); 70var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path);
EditAndContinue\RudeEditDiagnosticTests.cs (1)
22var tree = SyntaxFactory.ParseCompilationUnit("class C { }").SyntaxTree;
Microsoft.CodeAnalysis.Scripting.TestUtilities (2)
TestCompilationFactory.cs (2)
24new[] { CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From(source, encoding: null, SourceHashAlgorithms.Default)) }, 42new[] { CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From(source, encoding: null, SourceHashAlgorithms.Default)) },
Microsoft.CodeAnalysis.Test.Utilities (5)
AssemblyLoadTestFixture.cs (1)
532syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(SourceText.From(csSource, encoding: null, SourceHashAlgorithms.Default)) },
CommonTestBase.cs (1)
388var tree = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From(code, encoding: null, SourceHashAlgorithms.Default), options: parseOptions);
Syntax\TokenUtilities.cs (2)
76return CS.SyntaxFactory.ParseTokens(text).Select(t => (SyntaxToken)t).Where(t => !SkipCSharpToken(t)).ToList(); 100return CS.SyntaxFactory.ParseCompilationUnit(expectedText, options: (CS.CSharpParseOptions)options);
TestBase.cs (1)
192var syntaxTree = Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From(source, encoding: null, SourceHashAlgorithms.Default));
Microsoft.CodeAnalysis.UnitTests (10)
CommonSyntaxTests.cs (10)
80SyntaxNode node = CSharp.SyntaxFactory.IdentifierName("test"); 89SyntaxTrivia trivia = CSharp.SyntaxFactory.Whitespace("test"); 112var csharpToken = CSharp.SyntaxFactory.ParseExpression("1 + 123 /*hello*/").GetLastToken(); 186var node = CSharp.SyntaxFactory.IdentifierName("a"); 188var token = CSharp.SyntaxFactory.Token(CSharp.SyntaxKind.IfKeyword); 190var trivia = CSharp.SyntaxFactory.Comment("c"); 208var expr = CSharp.SyntaxFactory.ParseExpression("a + b + c + d"); 217computeReplacementNode: (node, rewritten) => CSharp.SyntaxFactory.ParenthesizedExpression(rewritten)); 229var expr = CSharp.SyntaxFactory.ParseExpression("a + b + c + d"); 240computeReplacementNode: (node, rewritten) => CSharp.SyntaxFactory.ParenthesizedExpression(rewritten).WithAdditionalAnnotations(annotation));
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
Compilation\CompilationAPITests.vb (2)
1388Dim t1 = CS.SyntaxFactory.ParseSyntaxTree(s1) 1393csComp = csComp.AddSyntaxTrees(t1, CS.SyntaxFactory.ParseSyntaxTree("Imports Goo"))
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
341var newDecl = decl.WithIdentifier(CS.SyntaxFactory.Identifier("Pogrom").WithLeadingTrivia(decl.Identifier.LeadingTrivia).WithTrailingTrivia(decl.Identifier.TrailingTrivia));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Workspaces\TestWorkspace_XmlConsumption.cs (1)
794return Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseSyntaxTree(sourceText, options);
Microsoft.CodeAnalysis.Workspaces.UnitTests (65)
BatchFixAllProviderTests.cs (1)
127var newToken = SyntaxFactory.Literal(token.LeadingTrivia, replacement.ToString(), replacement, token.TrailingTrivia);
CodeCleanup\CodeCleanupTests.cs (5)
353root = root.ReplaceToken(previousToken, CSharp.SyntaxFactory.Identifier(previousToken.LeadingTrivia, previousToken.ValueText, previousToken.TrailingTrivia)); 354root = root.ReplaceToken(nextToken, CSharp.SyntaxFactory.Token(nextToken.LeadingTrivia, CSharp.CSharpExtensions.Kind(nextToken), nextToken.TrailingTrivia)); 366=> CSharp.SyntaxFactory.MethodDeclaration(CSharp.SyntaxFactory.ParseTypeName(returnType), CSharp.SyntaxFactory.Identifier(methodName));
CodeCleanup\Extensions.cs (2)
37var newMembers = CSharp.SyntaxFactory.List(node.RemoveMember<CSharp.Syntax.MemberDeclarationSyntax>(index)); 45var newMembers = CSharp.SyntaxFactory.List(node.AddMember<CSharp.Syntax.MemberDeclarationSyntax>(member, index));
Editing\SyntaxEditorTests.cs (9)
47var cu = SyntaxFactory.ParseCompilationUnit(code); 73var cu = SyntaxFactory.ParseCompilationUnit(code); 98var cu = SyntaxFactory.ParseCompilationUnit(code); 125var cu = SyntaxFactory.ParseCompilationUnit(code); 152var cu = SyntaxFactory.ParseCompilationUnit(code); 173var cu = SyntaxFactory.ParseCompilationUnit(code); 219var cu = SyntaxFactory.ParseCompilationUnit(code); 263var cu = SyntaxFactory.ParseCompilationUnit(code); 308var cu = SyntaxFactory.ParseCompilationUnit(code);
FormattingTests.cs (1)
72var tree = CS.SyntaxFactory.ParseSyntaxTree(input);
Simplifier\SimplifierTests.cs (4)
35var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("Test")); 46var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("Test"));
SolutionTests\SolutionTests.cs (8)
304var tree = CS.SyntaxFactory.ParseSyntaxTree("class NewClass {}"); 2454var root = CSharp.SyntaxFactory.ParseCompilationUnit("class C {}"); 2483var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).GetRoot(); 2512var root = CSharp.SyntaxFactory.ParseCompilationUnit("class C {}"); 3236newSyntaxRoot = syntaxRoot.ReplaceNode(classNode, classNode.WithModifiers([CS.SyntaxFactory.ParseToken("public")])); 3432var tree = CSharp.SyntaxFactory.ParseSyntaxTree("public class C {}").GetRoot(CancellationToken.None); 3792var newRoot = (language == LanguageNames.CSharp) ? CS.SyntaxFactory.ParseCompilationUnit(""" 3997var newRoot = root.WithLeadingTrivia(root.GetLeadingTrivia().Add(CS.SyntaxFactory.Whitespace(" ")));
SymbolKeyTests.cs (1)
1481var tree = CSharp.SyntaxFactory.ParseSyntaxTree(source, path: path);
SyntaxNodeTests.cs (5)
29var tree = SyntaxFactory.ParseSyntaxTree(text); 36return Task.FromResult<SyntaxNode>(decl.WithIdentifier(SyntaxFactory.Identifier("Y"))); 50var tree = SyntaxFactory.ParseSyntaxTree(text); 61return Task.FromResult<SyntaxNode>(classDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia))); 67return Task.FromResult<SyntaxNode>(varDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia)));
SyntaxPathTests.cs (24)
21var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("Hi")); 31var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("Hi")); 34Assert.False(path.TryResolve(SyntaxFactory.ParseExpression("Goo()"), out SyntaxNode _)); 40var node = SyntaxFactory.ParseExpression("Goo()"); 50var root = SyntaxFactory.ParseExpression("Goo(a, b)"); 53var root2 = SyntaxFactory.ParseExpression("Goo(a)"); 60var root = SyntaxFactory.ParseExpression("Goo(a)"); 63var root2 = SyntaxFactory.ParseExpression("Goo(3)"); 70var root = SyntaxFactory.ParseExpression("Goo()"); 80var tree = SyntaxFactory.ParseSyntaxTree(string.Empty); 91var tree = SyntaxFactory.ParseSyntaxTree(string.Empty); 105var tree = SyntaxFactory.ParseSyntaxTree(text); 119var tree = SyntaxFactory.ParseSyntaxTree(text); 146var tree = SyntaxFactory.ParseSyntaxTree(text); 184var tree = SyntaxFactory.ParseSyntaxTree(text); 217var tree = SyntaxFactory.ParseSyntaxTree(text); 249var tree = SyntaxFactory.ParseSyntaxTree(text); 277var tree = SyntaxFactory.ParseSyntaxTree(text); 308var tree = SyntaxFactory.ParseSyntaxTree(text); 337var tree = SyntaxFactory.ParseSyntaxTree(text); 376var tree = SyntaxFactory.ParseSyntaxTree(text); 398var tree = SyntaxFactory.ParseSyntaxTree(text);
UtilityTest\DocumentationCommentIdTests.cs (1)
19var syntaxTree = SyntaxFactory.ParseSyntaxTree(sourceText);
UtilityTest\FormattingRangeHelperTests.cs (4)
19var root = SyntaxFactory.ParseSyntaxTree("{Foo();}").GetRoot(); 29var root = SyntaxFactory.ParseSyntaxTree("{Fizz();\nBuzz();}").GetRoot(); 39var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").GetRoot().GetFirstToken(); 47var token = SyntaxFactory.ParseToken("else");
Microsoft.DotNet.GenFacades (7)
NotSupportedAssemblyGenerator.cs (7)
124block = (BlockSyntax)SyntaxFactory.ParseStatement(emptyBody); 128block = (BlockSyntax)SyntaxFactory.ParseStatement(GetDefaultMessage()); 159BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(GetDefaultMessage()); 165BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(emptyBody); 175BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(message); 185BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(GetDefaultMessage()); 194BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(GetDefaultMessage());
Microsoft.Gen.ContextualOptions.Unit.Tests (9)
EmitterTests.cs (9)
26var delarations = SyntaxFactory 36var syntaxTree = SyntaxFactory.ParseSyntaxTree(generatedStruct); 45var delarations = SyntaxFactory 49.Concat(SyntaxFactory 60var syntaxTree = SyntaxFactory.ParseSyntaxTree(generatedStruct); 77var delarations = SyntaxFactory 89var syntaxTree = SyntaxFactory.ParseSyntaxTree(generatedStruct); 105var delarations = SyntaxFactory 117var syntaxTree = SyntaxFactory.ParseSyntaxTree(generatedStruct);
Microsoft.Gen.Logging.Unit.Tests (18)
ParserUtilitiesTests.cs (18)
19var propertyDeclaration = SyntaxFactory.PropertyDeclaration( 21SyntaxFactory.TokenList( 22SyntaxFactory.Token(SyntaxKind.PublicKeyword), 23SyntaxFactory.Token(SyntaxKind.StaticKeyword), 24SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 25SyntaxFactory.ParseTypeName("string"), 27SyntaxFactory.Identifier("Identifier_1"), 30var anotherPropertyDeclaration = SyntaxFactory.PropertyDeclaration( 32SyntaxFactory.TokenList( 33SyntaxFactory.Token(SyntaxKind.ProtectedKeyword), 34SyntaxFactory.Token(SyntaxKind.VirtualKeyword)), 35SyntaxFactory.ParseTypeName("object"), 37SyntaxFactory.Identifier("Identifier_2"), 60var propertyDeclaration = SyntaxFactory.FieldDeclaration( 62SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 63SyntaxFactory.VariableDeclaration(SyntaxFactory.ParseTypeName("string")));
Microsoft.Interop.ComInterfaceGenerator (12)
AttributeInfo.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ComClassGenerator.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ComInterfaceGenerator.cs (1)
13using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ComMethodContext.cs (1)
12using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshallers\KeepAliveThisMarshaller.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshallers\ObjectUnwrapperResolver.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshallers\StructAsHResultMarshallerFactory.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
UnmanagedToManagedStubGenerator.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
VirtualMethodPointerStubGenerator.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
VtableIndexStubGenerator.cs (1)
13using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Microsoft.Interop.JavaScript.JSImportGenerator (41)
JSExportCodeGenerator.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
JSExportGenerator.cs (1)
13using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
JSImportCodeGenerator.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
JSImportGenerator.cs (1)
12using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
JSManagedTypeInfo.cs (29)
22Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)) 27Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.BoolKeyword)) 32Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ByteKeyword)) 37Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.CharKeyword)) 42Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ShortKeyword)) 47Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword)) 52Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.LongKeyword)) 57Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.FloatKeyword)) 62Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.DoubleKeyword)) 68Syntax = SyntaxFactory.IdentifierName("nint") 73Syntax = SyntaxFactory.ParseTypeName(fullTypeName.Trim()) 78Syntax = SyntaxFactory.ParseTypeName(fullTypeName.Trim()) 83Syntax = SyntaxFactory.ParseTypeName(fullTypeName.Trim()) 88Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ObjectKeyword)) 93Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.StringKeyword)) 98Syntax = SyntaxFactory.ParseTypeName(fullTypeName.Trim()) 119return new JSTaskTypeInfo(new JSSimpleTypeInfo(KnownManagedType.Void, SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword))));
Marshaling\ArrayJSGenerator.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\ArraySegmentJSGenerator.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\BaseJSGenerator.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\FuncJSGenerator.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\NullableJSGenerator.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\PrimitiveJSGenerator.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\SpanJSGenerator.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshaling\TaskJSGenerator.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Microsoft.Interop.LibraryImportGenerator (22)
Analyzers\ConvertToLibraryImportFixer.cs (21)
330SyntaxFactory.Argument(SyntaxFactory.IdentifierName( 331SyntaxFactory.Identifier( 332SyntaxFactory.TriviaList(), 336SyntaxFactory.TriviaList()))) 337.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 366SyntaxFactory.Argument(SyntaxFactory.DeclarationExpression( 368SyntaxFactory.SingleVariableDesignation( 370.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 384SyntaxFactory.Argument(generator.ClearTrivia(assignment.Left)) 385.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 516SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, 517SyntaxFactory.Literal(AppendSuffix(entryPoint, entryPointSuffix))))); 526SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, 528SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, 529SyntaxFactory.Literal(entryPointSuffix.ToString()))))); 555SyntaxFactory.SeparatedList( 616? SyntaxFactory.CollectionExpression( 617SyntaxFactory.SingletonSeparatedList<CollectionElementSyntax>( 618SyntaxFactory.ExpressionElement(typeOfExpression)))
LibraryImportGenerator.cs (1)
14using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
DownlevelLibraryImportGenerator.cs (1)
14using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Microsoft.Interop.SourceGeneration (28)
BoundGenerators.cs (1)
13using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ContainingSyntaxContext.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
GeneratedStatements.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ManagedToNativeStubGenerator.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
ManagedTypeInfo.cs (1)
16public TypeSyntax Syntax => _syntax ??= SyntaxFactory.ParseTypeName(FullTypeName);
MarshalAsParser.cs (1)
12using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\BlittableMarshaller.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\BoolMarshaller.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\CharMarshaller.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\DelegateMarshaller.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\ElementsMarshalling.cs (1)
11using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\MarshallerHelpers.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\MarshallingGeneratorExtensions.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\StatefulMarshallingStrategy.cs (1)
8using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\StatelessMarshallingStrategy.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (1)
9using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
MarshallingAttributeInfo.cs (1)
136_ => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsDefaultMarshaller}<{MarshallerHelpers.GetCompatibleGenericTypeParameterSyntax(SyntaxFactory.ParseTypeName(unmanagedReturnType.FullTypeName))}>", unmanagedReturnType),
SignatureContext.cs (1)
15using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
SyntaxExtensions.cs (3)
34block = SyntaxFactory.Block(fixedStatement.Statement); 70return SyntaxFactory.Block(statement); 117return modifiers.Insert(idxInsert, SyntaxFactory.Token(modifierToAdd));
TypeNames.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
TypePositionInfo.cs (1)
10using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
TypeSymbolExtensions.cs (1)
172return SyntaxFactory.ParseTypeName(type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat));
Utils\SyntaxFactoryExtensions.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
VariableDeclarations.cs (1)
7using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
Microsoft.ML.AutoML (1)
Utils\Entity.cs (1)
109var exp = SyntaxFactory.ParseExpression(expression);
Microsoft.ML.InternalCodeAnalyzer (3)
ContractsCheckNameofFixProvider.cs (3)
89candidate = SyntaxFactory.ParseExpression(node.Parent.ToString()); 169var nameofExp = SyntaxFactory.ParseExpression($"nameof({name})").WithTriviaFrom(nameArg); 178var nameofExp = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression($"nameof(a)").WithTriviaFrom(nameArg);
Microsoft.VisualStudio.LanguageServices.CSharp (74)
ChangeSignature\CSharpChangeSignatureViewModelFactoryService.cs (3)
35var isPredefinedType = SyntaxFactory.ParseExpression(addedParameterViewModel.Type).Kind() == SyntaxKind.PredefinedType; 55public override bool IsTypeNameValid(string typeName) => !SyntaxFactory.ParseTypeName(typeName, options: s_langVersionLatestParseOptions).ContainsDiagnostics; 57public override SyntaxNode GetTypeNode(string typeName) => SyntaxFactory.ParseTypeName(typeName);
CodeModel\CSharpCodeModelService.cs (64)
41private static readonly SyntaxTree s_emptyTree = SyntaxFactory.ParseSyntaxTree(SourceText.From("", encoding: null, SourceHashAlgorithms.Default)); 879var newIdentifier = SyntaxFactory.Identifier(name); 906SyntaxFactory.ParseName(name) 907.WithLeadingTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker)) 908.WithTrailingTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker))); 915SyntaxFactory.ParseName(name) 916.WithLeadingTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker)) 917.WithTrailingTrivia(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker))); 919return ((AttributeArgumentSyntax)node).WithNameEquals(SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name))); 971var typeName = SyntaxFactory.ParseTypeName(name); 1293var newTriviaList = SyntaxFactory.ParseLeadingTrivia(commentText); 1426var newTriviaList = SyntaxFactory.ParseLeadingTrivia(builder.ToString()); 1703SyntaxFactory.AttributeTargetSpecifier(SyntaxFactory.Identifier(target))); 1727var parsedArgumentList = SyntaxFactory.ParseAttributeArgumentList("(" + value + ")"); 1766? SyntaxFactory.AttributeTargetSpecifier(SyntaxFactory.Identifier(target), 1767SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.ColonToken, [SyntaxFactory.Space])) 1770return SyntaxFactory.AttributeList( 1772attributes: [SyntaxFactory.Attribute( 1773name: SyntaxFactory.ParseName(name), 1774argumentList: SyntaxFactory.ParseAttributeArgumentList("(" + value + ")"))]); 1781return SyntaxFactory.AttributeArgument( 1782nameEquals: SyntaxFactory.NameEquals(name), 1784expression: SyntaxFactory.ParseExpression(value)); 1788return SyntaxFactory.AttributeArgument(SyntaxFactory.ParseExpression(value)); 1794var nameSyntax = SyntaxFactory.ParseName(name); 1798var aliasSyntax = SyntaxFactory.NameEquals(alias); 1799return SyntaxFactory.UsingDirective(aliasSyntax, nameSyntax); 1803return SyntaxFactory.UsingDirective(nameSyntax); 1808=> SyntaxFactory.Parameter(SyntaxFactory.Identifier(name)).WithType(SyntaxFactory.ParseTypeName(type)); 2307member = method.WithBody(null).WithSemicolonToken(SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.SemicolonToken, method.Body.CloseBraceToken.TrailingTrivia)); 2328var updatedAccessor = accessor.WithBody(null).WithSemicolonToken(SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.SemicolonToken, accessor.Body.CloseBraceToken.TrailingTrivia)); 2346var newBody = SyntaxFactory.Block(); 2366var newBody = SyntaxFactory.Block(); 2743var newType = SyntaxFactory.ParseTypeName(typeName); 2934var expression = SyntaxFactory.ParseExpression(value); 2937: SyntaxFactory.EqualsValueClause(expression); 2951var expression = SyntaxFactory.ParseExpression(value); 2954: SyntaxFactory.EqualsValueClause(expression); 2968var expression = SyntaxFactory.ParseExpression(value); 2972: SyntaxFactory.EqualsValueClause(expression); 3015var parsedTypeName = SyntaxFactory.ParseTypeName(partialName); 3026var parsedTypeName = SyntaxFactory.ParseTypeName(fullName); 3065return SyntaxFactory.ReturnStatement( 3066SyntaxFactory.DefaultExpression( 3067SyntaxFactory.ParseTypeName(type.ToDisplayString()))); 3329newArgumentList = SyntaxFactory.AttributeArgumentList([(AttributeArgumentSyntax)attributeArgument]); 3699var typeName = SyntaxFactory.ParseTypeName(typeSymbol.ToMinimalDisplayString(semanticModel, position)); 3701? typeDeclaration.BaseList.WithTypes(typeDeclaration.BaseList.Types.Insert(insertionIndex, SyntaxFactory.SimpleBaseType(typeName))) 3702: SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType(typeName)]);
CodeModel\ModifierFlagsExtensions.cs (1)
116newModifierList.Add(SyntaxFactory.Token(modifierDefinition.Value));
ProjectSystemShim\TempPECompilerService.cs (1)
46trees.Add(SyntaxFactory.ParseSyntaxTree(sourceText, parsedArguments.ParseOptions, fileNames[i]));
Snippets\CSharpSnippetExpansionLanguageHelper.cs (5)
129var candidateUsing = SyntaxFactory.ParseCompilationUnit("using " + namespaceToImport + ";").DescendantNodes().OfType<UsingDirectiveSyntax>().FirstOrDefault(); 137candidateUsing = SyntaxFactory.UsingDirective(SyntaxFactory.ParseName(namespaceToImport)) 138.WithUsingKeyword(UsingKeyword.WithTrailingTrivia(SyntaxFactory.Space)); 143newUsings.Add(candidateUsing.WithAdditionalAnnotations(Formatter.Annotation).WithAppendedTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed));
StackDepthTest (1)
Program.cs (1)
79var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(stringText, encoding: null, SourceHashAlgorithm.Sha256), parseOptions);
System.Text.RegularExpressions.Generator (5)
UpgradeToGeneratedRegexCodeFixer.cs (5)
133return typeDeclaration.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword)); 190newMethod = newMethod.ReplaceToken(newMethod.Identifier, SyntaxFactory.Identifier(methodName).WithAdditionalAnnotations(RenameAnnotation.Create())); 219regexOptionsValue ??= generator.MemberAccessExpression(SyntaxFactory.IdentifierName("RegexOptions"), "None"); 288return SyntaxFactory.ParseExpression(optionsLiteral); 301return SyntaxFactory.ParseExpression($"@\"{str}\"");
System.Windows.Forms.Analyzers.CodeFixes.CSharp (10)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (10)
81AttributeSyntax designerSerializationVisibilityAttribute = SyntaxFactory.Attribute( 82SyntaxFactory.ParseName(DesignerSerializationVisibilityAttributeName), 83SyntaxFactory.ParseAttributeArgumentList("(DesignerSerializationVisibility.Hidden)")); 91SyntaxFactory.AttributeList( 92SyntaxFactory.SingletonSeparatedList(designerSerializationVisibilityAttribute))); 132.WithLeadingTrivia(SyntaxFactory.CarriageReturnLineFeed) 135.Add(SyntaxFactory.CarriageReturnLineFeed)); 138UsingDirectiveSyntax usingDirective = SyntaxFactory 139.UsingDirective(SyntaxFactory.ParseName(SystemComponentModelName)); 143.WithTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed)