1 write to _syntaxFactory
Microsoft.CodeAnalysis.CSharp (1)
Parser\LanguageParser.cs (1)
46_syntaxFactory = new ContextAwareSyntax(_syntaxFactoryContext);
299 references to _syntaxFactory
Microsoft.CodeAnalysis.CSharp (299)
Parser\LanguageParser.cs (270)
190var result = _syntaxFactory.CompilationUnit(body.Externs, body.Usings, body.Attributes, body.Members, eof); 230var fileAsTrivia = _syntaxFactory.SkippedTokensTrivia(builder.ToList<SyntaxToken>()); 295return _syntaxFactory.FileScopedNamespaceDeclaration( 311return _syntaxFactory.NamespaceDeclaration( 934return _syntaxFactory.ExternAliasDirective( 944return _syntaxFactory.NameEquals( 945_syntaxFactory.IdentifierName(this.ParseIdentifierToken()), 1016return _syntaxFactory.UsingDirective(globalToken, usingToken, staticToken, unsafeToken, alias, type, semicolon); 1126? _syntaxFactory.AttributeTargetSpecifier(ConvertToKeyword(this.EatToken()), this.EatToken(SyntaxKind.ColonToken)) 1148return _syntaxFactory.AttributeList(openBracket, location, attributes, closeBracket); 1195return _syntaxFactory.Attribute( 1223return _syntaxFactory.AttributeArgumentList( 1272nameEquals = _syntaxFactory.NameEquals( 1273_syntaxFactory.IdentifierName(this.ParseIdentifierToken()), 1278nameColon = _syntaxFactory.NameColon( 1286return _syntaxFactory.AttributeArgument( 1835return constructTypeDeclaration(_syntaxFactory, attributes, modifiers, keyword, recordModifier, name, typeParameters, paramList, baseList, constraints, openBrace, members, closeBrace, semicolon); 2068? _syntaxFactory.PrimaryConstructorBaseType(firstType, this.ParseParenthesizedArgumentList()) 2069: _syntaxFactory.SimpleBaseType(firstType)); 2083list.Add(_syntaxFactory.SimpleBaseType(this.ParseType())); 2102list.Add(_syntaxFactory.SimpleBaseType(this.ParseType())); 2112return _syntaxFactory.BaseList(colon, _pool.ToListAndFree(list)); 2153bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected))); 2185bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected))); 2201return _syntaxFactory.TypeParameterConstraintClause( 2240_syntaxFactory.ConstructorConstraint( 2246_syntaxFactory.ClassOrStructConstraint( 2254_syntaxFactory.ClassOrStructConstraint( 2260_syntaxFactory.DefaultConstraint(defaultKeyword: this.EatToken()), 2263_syntaxFactory.TypeConstraint(AddTrailingSkippedSyntax( 2271? _syntaxFactory.TypeConstraint(this.ParseType()) 2272: _syntaxFactory.TypeConstraint(AddTrailingSkippedSyntax( 2291_syntaxFactory.RefStructConstraint( 2304return _syntaxFactory.AllowsConstraintClause(allows, _pool.ToListAndFree(bounds)); 2307return _syntaxFactory.TypeConstraint(this.ParseType()); 2451return @this._syntaxFactory.IncompleteMember( 2525return _syntaxFactory.GlobalStatement(ParseUnsafeStatement(attributes)); 2532return _syntaxFactory.GlobalStatement(ParseFixedStatement(attributes)); 2541return _syntaxFactory.GlobalStatement(ParseExpressionStatement(attributes)); 2548return _syntaxFactory.GlobalStatement(ParseExpressionStatement(attributes)); 2578var voidType = _syntaxFactory.PredefinedType( 2673return _syntaxFactory.GlobalStatement(statement); 2820result = _syntaxFactory.GlobalStatement(declaration); 2848result = _syntaxFactory.GlobalStatement(statement); 2930result = _syntaxFactory.IncompleteMember(attributes, modifiers.ToList(), type); 2951var incompleteMember = _syntaxFactory.IncompleteMember(attributes, modifiers.ToList(), type.IsMissing ? null : type); 3317return _syntaxFactory.ConstructorDeclaration(attributes, modifiers.ToList(), name, paramList, initializer, body, expressionBody, semicolon); 3349: _syntaxFactory.ArgumentList( 3354return _syntaxFactory.ConstructorInitializer(kind, colon, token, argumentList); 3363var parameterList = _syntaxFactory.ParameterList( 3371return _syntaxFactory.DestructorDeclaration(attributes, modifiers.ToList(), tilde, name, parameterList, body, expressionBody, semicolon); 3512return _syntaxFactory.MethodDeclaration( 3653return _syntaxFactory.ConversionOperatorDeclaration( 3661_syntaxFactory.ParameterList( 3692return _syntaxFactory.ConversionOperatorDeclaration( 3772return _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 3945return _syntaxFactory.OperatorDeclaration( 4007return _syntaxFactory.IndexerDeclaration( 4063initializer = _syntaxFactory.EqualsValueClause(equals, value: value); 4076return _syntaxFactory.PropertyDeclaration( 4144return _syntaxFactory.AccessorList( 4152return _syntaxFactory.ArrowExpressionClause( 4165return refKeyword == null ? expression : _syntaxFactory.RefExpression(refKeyword, expression); 4476return _syntaxFactory.AccessorDeclaration( 4513return _syntaxFactory.ParameterList(open, parameters, close); 4524return _syntaxFactory.BracketedParameterList(open, parameters, close); 4694return _syntaxFactory.Parameter( 4720return _syntaxFactory.Parameter( 4725equalsToken == null ? null : _syntaxFactory.EqualsValueClause(equalsToken, this.ParseExpressionCore())); 4794return _syntaxFactory.FieldDeclaration( 4796_syntaxFactory.VariableDeclaration( 4833return _syntaxFactory.EventDeclaration( 4842_syntaxFactory.AccessorList( 4891var decl = _syntaxFactory.EventDeclaration( 4930type = _syntaxFactory.ScopedType(scopedKeyword, type); 4934return _syntaxFactory.FieldDeclaration( 4937_syntaxFactory.VariableDeclaration(type, variables), 4968return _syntaxFactory.EventFieldDeclaration( 4972_syntaxFactory.VariableDeclaration(type, variables), 5283return _syntaxFactory.VariableDeclarator(missingIdentifier, null, null); 5332initializer = _syntaxFactory.EqualsValueClause( 5334refKeyword == null ? init : _syntaxFactory.RefExpression(refKeyword, init)); 5391args.Add(_syntaxFactory.Argument(null, refKindKeyword: null, expression)); 5399argumentList = _syntaxFactory.BracketedArgumentList(open, _pool.ToListAndFree(args), close); 5434return _syntaxFactory.VariableDeclarator(name, argumentList, initializer); 5486return _syntaxFactory.FieldDeclaration( 5489_syntaxFactory.VariableDeclaration( 5516return _syntaxFactory.DelegateDeclaration( 5550tmpList.Add(_syntaxFactory.SimpleBaseType(type)); 5551baseList = _syntaxFactory.BaseList( 5591return _syntaxFactory.EnumDeclaration( 5625equalsValue = _syntaxFactory.EqualsValueClause( 5632return _syntaxFactory.EnumMemberDeclaration(memberAttrs, modifiers: default, memberName, equalsValue); 5653return _syntaxFactory.IdentifierName(CreateMissingIdentifierToken()); 5800return _syntaxFactory.TypeParameterList( 5835return _syntaxFactory.TypeParameter( 5850return _syntaxFactory.TypeParameter( 5883name = _syntaxFactory.GenericName( 5885_syntaxFactory.TypeArgumentList( 6230var omittedTypeArgumentInstance = _syntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 6546explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier( 6561explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 6699explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 6741return _syntaxFactory.QualifiedName(left, separator, right); 6756return _syntaxFactory.QualifiedName(left, separator, right); 6762identifierLeft = _syntaxFactory.IdentifierName(ConvertToKeyword(identifierLeft.Identifier)); 6767return WithAdditionalDiagnostics(_syntaxFactory.AliasQualifiedName(identifierLeft, separator, right), left.GetDiagnostics()); 7226return _syntaxFactory.PredefinedType(this.EatToken()); 7250return _syntaxFactory.RefType( 7303type = _syntaxFactory.NullableType(type, question); 7346type = _syntaxFactory.ArrayType(type, _pool.ToListAndFree(ranks)); 7547var omittedArraySizeExpressionInstance = _syntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 7598return _syntaxFactory.ArrayRankSpecifier( 7624list.Add(_syntaxFactory.TupleElement(this.CreateMissingIdentifierName(), identifier: null)); 7629list.Add(_syntaxFactory.TupleElement(missing, identifier: null)); 7632return _syntaxFactory.TupleType( 7640return _syntaxFactory.TupleElement( 7664return _syntaxFactory.PredefinedType(token); 7862type = _syntaxFactory.PointerType(type, this.EatToken()); 8031return _syntaxFactory.EmptyStatement(attributes, this.EatToken()); 8689var block = _syntaxFactory.Block( 8720return _syntaxFactory.Block( 8864return _syntaxFactory.FixedStatement( 8922return _syntaxFactory.BreakStatement( 8930return _syntaxFactory.ContinueStatement( 8976finallyClause = _syntaxFactory.FinallyClause( 8987finallyClause = _syntaxFactory.FinallyClause( 8992return _syntaxFactory.TryStatement( 9000=> _syntaxFactory.Block( 9036decl = _syntaxFactory.CatchDeclaration(openParen, type, name, closeParen); 9061filter = _syntaxFactory.CatchFilterClause(whenKeyword, openParen, filterExpression, closeParen); 9068return _syntaxFactory.CatchClause(@catch, decl, filter, block); 9105return _syntaxFactory.CheckedStatement( 9125return _syntaxFactory.DoStatement( 9199var forStatement = _syntaxFactory.ForStatement( 9376return _syntaxFactory.ForEachStatement(attributes, awaitTokenOpt, @foreach, openParen, decl.Type, identifier, @in, expression, closeParen, statement); 9380return _syntaxFactory.ForEachVariableStatement(attributes, awaitTokenOpt, @foreach, openParen, variable, @in, expression, closeParen, statement); 9564return _syntaxFactory.GotoStatement( 9613_syntaxFactory.ElseClause( 9616ifStatement = _syntaxFactory.IfStatement( 9637return _syntaxFactory.IfStatement( 9651: _syntaxFactory.ElseClause( 9659return _syntaxFactory.LockStatement( 9671return _syntaxFactory.ReturnStatement( 9706return _syntaxFactory.YieldStatement( 9725return _syntaxFactory.SwitchStatement( 9808label = _syntaxFactory.CaseSwitchLabel( 9819node = _syntaxFactory.ConstantPattern(ex); 9826label = _syntaxFactory.CasePatternSwitchLabel( 9834label = _syntaxFactory.CaseSwitchLabel( 9844label = _syntaxFactory.DefaultSwitchLabel( 9858return _syntaxFactory.SwitchSection( 9866return _syntaxFactory.ThrowStatement( 9876return _syntaxFactory.UnsafeStatement( 9894return _syntaxFactory.UsingStatement( 10012return _syntaxFactory.WhileStatement( 10027return _syntaxFactory.LabeledStatement( 10106type = _syntaxFactory.ScopedType(scopedKeyword, type); 10123return _syntaxFactory.LocalDeclarationStatement( 10128_syntaxFactory.VariableDeclaration(type, variables.ToList()), 10233result = _syntaxFactory.ParenthesizedVariableDesignation( 10253? _syntaxFactory.DiscardDesignation(this.EatContextualToken(SyntaxKind.UnderscoreToken)) 10254: _syntaxFactory.SingleVariableDesignation(this.EatToken(SyntaxKind.IdentifierToken)); 10264return _syntaxFactory.WhenClause( 10292return _syntaxFactory.VariableDeclaration( 10311type = _syntaxFactory.ScopedType(scopedKeyword, type); 10580return _syntaxFactory.LocalFunctionStatement( 10612return _syntaxFactory.ExpressionStatement(attributes, expression, semicolon); 11023return _syntaxFactory.PrefixUnaryExpression( 11034return _syntaxFactory.RangeExpression( 11044return _syntaxFactory.AwaitExpression( 11158return _syntaxFactory.BinaryExpression( 11173return _syntaxFactory.RangeExpression( 11189rhs = _syntaxFactory.RefExpression( 11198return _syntaxFactory.AssignmentExpression( 11203return _syntaxFactory.BinaryExpression(operatorExpressionKind, leftOperand, operatorToken, this.ParseSubExpression(newPrecedence)); 11356var conditionalExpression = _syntaxFactory.ConditionalExpression( 11361_syntaxFactory.IdentifierName(SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))); 11366return _syntaxFactory.ConditionalExpression( 11458return _syntaxFactory.DeclarationExpression( 11459scopedKeyword == null ? type : _syntaxFactory.ScopedType(scopedKeyword, type), 11465return _syntaxFactory.ThrowExpression( 11475PatternSyntax pattern => _syntaxFactory.IsPatternExpression(leftOperand, opToken, pattern), 11476TypeSyntax type => _syntaxFactory.BinaryExpression(SyntaxKind.IsExpression, leftOperand, opToken, type), 11548return _syntaxFactory.FieldExpression(this.EatContextualToken(SyntaxKind.FieldKeyword)); 11565return _syntaxFactory.ThisExpression(this.EatToken()); 11581return _syntaxFactory.LiteralExpression(SyntaxFacts.GetLiteralExpression(tk), this.EatToken()); 11612return this.AddError(_syntaxFactory.RefExpression(refKeyword, this.ParseExpressionCore()), ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk)); 11622var expr = _syntaxFactory.PredefinedType(this.EatToken()); 11662expr = _syntaxFactory.InvocationExpression(expr, this.ParseParenthesizedArgumentList()); 11666expr = _syntaxFactory.ElementAccessExpression(expr, this.ParseBracketedArgumentList()); 11671expr = _syntaxFactory.PostfixUnaryExpression(SyntaxFacts.GetPostfixUnaryExpression(this.CurrentToken.Kind), expr, this.EatToken()); 11677expr = _syntaxFactory.MemberAccessExpression( 11693expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.PointerMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11710return _syntaxFactory.MemberAccessExpression( 11715expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11721expr = _syntaxFactory.ConditionalAccessExpression( 11731expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, this.EatToken()); 11744return _syntaxFactory.BaseExpression(this.EatToken()); 11861SyntaxKind.DotToken => _syntaxFactory.MemberBindingExpression(this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)), 11862SyntaxKind.OpenBracketToken => _syntaxFactory.ElementBindingExpression(this.ParseBracketedArgumentList()), 11873expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, EatToken()); 11879expr = _syntaxFactory.InvocationExpression(expr, this.ParseParenthesizedArgumentList()); 11883expr = _syntaxFactory.ElementAccessExpression(expr, this.ParseBracketedArgumentList()); 11887expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11893: _syntaxFactory.ConditionalAccessExpression( 11930return _syntaxFactory.ArgumentList(openToken, arguments, closeToken); 11946return _syntaxFactory.BracketedArgumentList(openToken, arguments, closeToken); 12058? _syntaxFactory.NameColon( 12095return _syntaxFactory.Argument(nameColon, refKindKeyword, expression); 12100return _syntaxFactory.TypeOfExpression( 12112return _syntaxFactory.DefaultExpression( 12120return _syntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression, keyword); 12126return _syntaxFactory.SizeOfExpression( 12135return _syntaxFactory.MakeRefExpression( 12144return _syntaxFactory.RefTypeExpression( 12157return _syntaxFactory.CheckedExpression( 12167return _syntaxFactory.RefValueExpression( 12309return _syntaxFactory.CastExpression( 12327_syntaxFactory.Argument(nameColon: null, refKindKeyword: null, expression)); 12335_syntaxFactory.Argument( 12336_syntaxFactory.NameColon((IdentifierNameSyntax)expression, EatToken()), 12341return _syntaxFactory.ParenthesizedExpression( 12358? _syntaxFactory.Argument(nameColon: null, refKindKeyword: null, expression: expression) 12359: _syntaxFactory.Argument( 12360_syntaxFactory.NameColon((IdentifierNameSyntax)expression, EatToken()), 12370list.Add(_syntaxFactory.Argument( 12375return _syntaxFactory.TupleExpression( 12726return _syntaxFactory.CollectionExpression( 12749? _syntaxFactory.SpreadElement(this.EatDotDotToken(), this.ParseExpressionCore()) 12750: _syntaxFactory.ExpressionElement(this.ParseExpressionCore()); 12776return _syntaxFactory.AnonymousObjectCreationExpression( 12785return _syntaxFactory.AnonymousObjectMemberDeclarator( 12831return _syntaxFactory.ArrayCreationExpression(@new, (ArrayTypeSyntax)type, initializer); 12849argumentList = _syntaxFactory.ArgumentList( 12856? _syntaxFactory.ImplicitObjectCreationExpression(@new, argumentList, initializer) 12857: _syntaxFactory.ObjectCreationExpression(@new, type, argumentList, initializer); 12901return _syntaxFactory.WithExpression( 12904_syntaxFactory.InitializerExpression( 12929return _syntaxFactory.InitializerExpression( 13000return _syntaxFactory.AssignmentExpression( 13011return _syntaxFactory.AssignmentExpression( 13013_syntaxFactory.ImplicitElementAccess(this.ParseBracketedArgumentList()), 13034return _syntaxFactory.InitializerExpression( 13079return _syntaxFactory.ImplicitArrayCreationExpression( 13100return _syntaxFactory.InitializerExpression( 13147return _syntaxFactory.ImplicitStackAllocArrayCreationExpression( 13156return _syntaxFactory.StackAllocArrayCreationExpression( 13204return _syntaxFactory.AnonymousMethodExpression( 13208_syntaxFactory.Block( 13216return _syntaxFactory.AnonymousMethodExpression( 13327return _syntaxFactory.ParenthesizedLambdaExpression( 13341var parameter = _syntaxFactory.Parameter( 13344return _syntaxFactory.SimpleLambdaExpression( 13373return _syntaxFactory.ParameterList( 13433return _syntaxFactory.Parameter( 13439? _syntaxFactory.EqualsValueClause(equalsToken, this.ParseExpressionCore()) 13599return _syntaxFactory.QueryExpression(fc, body); 13637_ => _syntaxFactory.SelectClause( 13642return _syntaxFactory.QueryBody( 13675return _syntaxFactory.FromClause( 13686return _syntaxFactory.JoinClause( 13699? _syntaxFactory.JoinIntoClause(ConvertToKeyword(this.EatToken()), this.ParseIdentifierToken()) 13706return _syntaxFactory.LetClause( 13716return _syntaxFactory.WhereClause( 13749return _syntaxFactory.OrderByClause( 13781return _syntaxFactory.Ordering(kind, expression, direction); 13787return _syntaxFactory.SelectClause( 13795return _syntaxFactory.GroupClause( 13805return _syntaxFactory.QueryContinuation(
Parser\LanguageParser_Patterns.cs (29)
28DiscardPatternSyntax dp => _syntaxFactory.IdentifierName(ConvertToIdentifier(dp.UnderscoreToken)), 42type = _syntaxFactory.QualifiedName(leftType, dotToken, simpleName); 63result = _syntaxFactory.BinaryPattern( 109result = _syntaxFactory.BinaryPattern( 162return _syntaxFactory.UnaryPattern( 184return _syntaxFactory.ConstantPattern(this.ParseIdentifierName(ErrorCode.ERR_MissingPattern)); 189return _syntaxFactory.DiscardPattern(this.EatContextualToken(SyntaxKind.UnderscoreToken)); 197return _syntaxFactory.SlicePattern( 210return _syntaxFactory.RelationalPattern( 236return _syntaxFactory.ConstantPattern(value); 281return _syntaxFactory.VarPattern(varToken, varDesignation); 322ExpressionSyntax expression = _syntaxFactory.ParenthesizedExpression(openParenToken, cp.Expression, closeParenToken); 324return _syntaxFactory.ConstantPattern(expression); 326return _syntaxFactory.ParenthesizedPattern(openParenToken, subpattern, closeParenToken); 331var positionalPatternClause = _syntaxFactory.PositionalPatternClause(openParenToken, subPatterns, closeParenToken); 332var result = _syntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause0, designation0); 338return _syntaxFactory.RecursivePattern( 347return _syntaxFactory.DeclarationPattern(type, designation); 351? _syntaxFactory.ConstantPattern(ParseExpressionContinued(expression, precedence)) 352: _syntaxFactory.TypePattern(type); 449DiscardPatternSyntax dp => _syntaxFactory.IdentifierName(ConvertToIdentifier(dp.UnderscoreToken)), 467expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, newLeft, dotToken, right); 497return _syntaxFactory.PropertyPatternClause( 513? _syntaxFactory.NameColon(identifierName, colon) 514: _syntaxFactory.ExpressionColon(expr, colon); 519return _syntaxFactory.Subpattern(exprColon, pattern); 573return _syntaxFactory.SwitchExpression( 604var switchExpressionCase = _syntaxFactory.SwitchExpressionArm( 648return _syntaxFactory.ListPattern(