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); 2070? _syntaxFactory.PrimaryConstructorBaseType(firstType, argumentList) 2071: _syntaxFactory.SimpleBaseType(firstType)); 2085list.Add(_syntaxFactory.SimpleBaseType(this.ParseType())); 2094return _syntaxFactory.BaseList(colon, _pool.ToListAndFree(list)); 2135bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected))); 2167bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected))); 2183return _syntaxFactory.TypeParameterConstraintClause( 2222_syntaxFactory.ConstructorConstraint( 2228_syntaxFactory.ClassOrStructConstraint( 2236_syntaxFactory.ClassOrStructConstraint( 2242_syntaxFactory.DefaultConstraint(defaultKeyword: this.EatToken()), 2245_syntaxFactory.TypeConstraint(AddTrailingSkippedSyntax( 2253? _syntaxFactory.TypeConstraint(this.ParseType()) 2254: _syntaxFactory.TypeConstraint(AddTrailingSkippedSyntax( 2273_syntaxFactory.RefStructConstraint( 2286return _syntaxFactory.AllowsConstraintClause(allows, _pool.ToListAndFree(bounds)); 2289return _syntaxFactory.TypeConstraint(this.ParseType()); 2433return @this._syntaxFactory.IncompleteMember( 2507return _syntaxFactory.GlobalStatement(ParseUnsafeStatement(attributes)); 2514return _syntaxFactory.GlobalStatement(ParseFixedStatement(attributes)); 2523return _syntaxFactory.GlobalStatement(ParseExpressionStatement(attributes)); 2530return _syntaxFactory.GlobalStatement(ParseExpressionStatement(attributes)); 2560var voidType = _syntaxFactory.PredefinedType( 2655return _syntaxFactory.GlobalStatement(statement); 2802result = _syntaxFactory.GlobalStatement(declaration); 2830result = _syntaxFactory.GlobalStatement(statement); 2912result = _syntaxFactory.IncompleteMember(attributes, modifiers.ToList(), type); 2933var incompleteMember = _syntaxFactory.IncompleteMember(attributes, modifiers.ToList(), type.IsMissing ? null : type); 3299return _syntaxFactory.ConstructorDeclaration(attributes, modifiers.ToList(), name, paramList, initializer, body, expressionBody, semicolon); 3331: _syntaxFactory.ArgumentList( 3336return _syntaxFactory.ConstructorInitializer(kind, colon, token, argumentList); 3345var parameterList = _syntaxFactory.ParameterList( 3353return _syntaxFactory.DestructorDeclaration(attributes, modifiers.ToList(), tilde, name, parameterList, body, expressionBody, semicolon); 3494return _syntaxFactory.MethodDeclaration( 3635return _syntaxFactory.ConversionOperatorDeclaration( 3643_syntaxFactory.ParameterList( 3674return _syntaxFactory.ConversionOperatorDeclaration( 3754return _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 3927return _syntaxFactory.OperatorDeclaration( 3989return _syntaxFactory.IndexerDeclaration( 4045initializer = _syntaxFactory.EqualsValueClause(equals, value: value); 4058return _syntaxFactory.PropertyDeclaration( 4126return _syntaxFactory.AccessorList( 4134return _syntaxFactory.ArrowExpressionClause( 4147return refKeyword == null ? expression : _syntaxFactory.RefExpression(refKeyword, expression); 4458return _syntaxFactory.AccessorDeclaration( 4495return _syntaxFactory.ParameterList(open, parameters, close); 4506return _syntaxFactory.BracketedParameterList(open, parameters, close); 4676return _syntaxFactory.Parameter( 4702return _syntaxFactory.Parameter( 4707equalsToken == null ? null : _syntaxFactory.EqualsValueClause(equalsToken, this.ParseExpressionCore())); 4773return _syntaxFactory.FieldDeclaration( 4775_syntaxFactory.VariableDeclaration( 4812return _syntaxFactory.EventDeclaration( 4821_syntaxFactory.AccessorList( 4870var decl = _syntaxFactory.EventDeclaration( 4909type = _syntaxFactory.ScopedType(scopedKeyword, type); 4913return _syntaxFactory.FieldDeclaration( 4916_syntaxFactory.VariableDeclaration(type, variables), 4947return _syntaxFactory.EventFieldDeclaration( 4951_syntaxFactory.VariableDeclaration(type, variables), 5238return _syntaxFactory.VariableDeclarator(missingIdentifier, null, null); 5287initializer = _syntaxFactory.EqualsValueClause( 5289refKeyword == null ? init : _syntaxFactory.RefExpression(refKeyword, init)); 5346args.Add(_syntaxFactory.Argument(null, refKindKeyword: null, expression)); 5354argumentList = _syntaxFactory.BracketedArgumentList(open, _pool.ToListAndFree(args), close); 5389return _syntaxFactory.VariableDeclarator(name, argumentList, initializer); 5441return _syntaxFactory.FieldDeclaration( 5444_syntaxFactory.VariableDeclaration( 5471return _syntaxFactory.DelegateDeclaration( 5505tmpList.Add(_syntaxFactory.SimpleBaseType(type)); 5506baseList = _syntaxFactory.BaseList( 5546return _syntaxFactory.EnumDeclaration( 5580equalsValue = _syntaxFactory.EqualsValueClause( 5587return _syntaxFactory.EnumMemberDeclaration(memberAttrs, modifiers: default, memberName, equalsValue); 5608return _syntaxFactory.IdentifierName(CreateMissingIdentifierToken()); 5755return _syntaxFactory.TypeParameterList( 5790return _syntaxFactory.TypeParameter( 5805return _syntaxFactory.TypeParameter( 5838name = _syntaxFactory.GenericName( 5840_syntaxFactory.TypeArgumentList( 6176var omittedTypeArgumentInstance = _syntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 6492explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier( 6507explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 6645explicitInterfaceOpt = _syntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceName, separator); 6687return _syntaxFactory.QualifiedName(left, separator, right); 6702return _syntaxFactory.QualifiedName(left, separator, right); 6708identifierLeft = _syntaxFactory.IdentifierName(ConvertToKeyword(identifierLeft.Identifier)); 6713return WithAdditionalDiagnostics(_syntaxFactory.AliasQualifiedName(identifierLeft, separator, right), left.GetDiagnostics()); 7172return _syntaxFactory.PredefinedType(this.EatToken()); 7196return _syntaxFactory.RefType( 7249type = _syntaxFactory.NullableType(type, question); 7292type = _syntaxFactory.ArrayType(type, _pool.ToListAndFree(ranks)); 7493var omittedArraySizeExpressionInstance = _syntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 7544return _syntaxFactory.ArrayRankSpecifier( 7570list.Add(_syntaxFactory.TupleElement(this.CreateMissingIdentifierName(), identifier: null)); 7575list.Add(_syntaxFactory.TupleElement(missing, identifier: null)); 7578return _syntaxFactory.TupleType( 7586return _syntaxFactory.TupleElement( 7610return _syntaxFactory.PredefinedType(token); 7808type = _syntaxFactory.PointerType(type, this.EatToken()); 7977return _syntaxFactory.EmptyStatement(attributes, this.EatToken()); 8635var block = _syntaxFactory.Block( 8666return _syntaxFactory.Block( 8810return _syntaxFactory.FixedStatement( 8868return _syntaxFactory.BreakStatement( 8876return _syntaxFactory.ContinueStatement( 8922finallyClause = _syntaxFactory.FinallyClause( 8933finallyClause = _syntaxFactory.FinallyClause( 8938return _syntaxFactory.TryStatement( 8946=> _syntaxFactory.Block( 8982decl = _syntaxFactory.CatchDeclaration(openParen, type, name, closeParen); 9007filter = _syntaxFactory.CatchFilterClause(whenKeyword, openParen, filterExpression, closeParen); 9014return _syntaxFactory.CatchClause(@catch, decl, filter, block); 9051return _syntaxFactory.CheckedStatement( 9071return _syntaxFactory.DoStatement( 9185declType = _syntaxFactory.ScopedType(scopedKeyword, declType); 9212return _syntaxFactory.ForStatement( 9322return _syntaxFactory.ForEachStatement(attributes, awaitTokenOpt, @foreach, openParen, decl.Type, identifier, @in, expression, closeParen, statement); 9326return _syntaxFactory.ForEachVariableStatement(attributes, awaitTokenOpt, @foreach, openParen, variable, @in, expression, closeParen, statement); 9510return _syntaxFactory.GotoStatement( 9559_syntaxFactory.ElseClause( 9562ifStatement = _syntaxFactory.IfStatement( 9583return _syntaxFactory.IfStatement( 9597: _syntaxFactory.ElseClause( 9605return _syntaxFactory.LockStatement( 9617return _syntaxFactory.ReturnStatement( 9652return _syntaxFactory.YieldStatement( 9671return _syntaxFactory.SwitchStatement( 9754label = _syntaxFactory.CaseSwitchLabel( 9765node = _syntaxFactory.ConstantPattern(ex); 9772label = _syntaxFactory.CasePatternSwitchLabel( 9780label = _syntaxFactory.CaseSwitchLabel( 9790label = _syntaxFactory.DefaultSwitchLabel( 9804return _syntaxFactory.SwitchSection( 9812return _syntaxFactory.ThrowStatement( 9822return _syntaxFactory.UnsafeStatement( 9840return _syntaxFactory.UsingStatement( 9874declaration = declaration.Update(_syntaxFactory.ScopedType(scopedKeyword, declaration.Type), declaration.Variables); 9959return _syntaxFactory.WhileStatement( 9974return _syntaxFactory.LabeledStatement( 10051type = _syntaxFactory.ScopedType(scopedKeyword, type); 10068return _syntaxFactory.LocalDeclarationStatement( 10073_syntaxFactory.VariableDeclaration(type, _pool.ToListAndFree(variables)), 10151result = _syntaxFactory.ParenthesizedVariableDesignation( 10171? _syntaxFactory.DiscardDesignation(this.EatContextualToken(SyntaxKind.UnderscoreToken)) 10172: _syntaxFactory.SingleVariableDesignation(this.EatToken(SyntaxKind.IdentifierToken)); 10182return _syntaxFactory.WhenClause( 10205return _syntaxFactory.VariableDeclaration( 10486return _syntaxFactory.LocalFunctionStatement( 10518return _syntaxFactory.ExpressionStatement(attributes, expression, semicolon); 10929return _syntaxFactory.PrefixUnaryExpression( 10940return _syntaxFactory.RangeExpression( 10950return _syntaxFactory.AwaitExpression( 11064return _syntaxFactory.BinaryExpression( 11079return _syntaxFactory.RangeExpression( 11095rhs = _syntaxFactory.RefExpression( 11104return _syntaxFactory.AssignmentExpression( 11109return _syntaxFactory.BinaryExpression(operatorExpressionKind, leftOperand, operatorToken, this.ParseSubExpression(newPrecedence)); 11262var conditionalExpression = _syntaxFactory.ConditionalExpression( 11267_syntaxFactory.IdentifierName(SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))); 11272return _syntaxFactory.ConditionalExpression( 11364return _syntaxFactory.DeclarationExpression( 11365scopedKeyword == null ? type : _syntaxFactory.ScopedType(scopedKeyword, type), 11371return _syntaxFactory.ThrowExpression( 11381PatternSyntax pattern => _syntaxFactory.IsPatternExpression(leftOperand, opToken, pattern), 11382TypeSyntax type => _syntaxFactory.BinaryExpression(SyntaxKind.IsExpression, leftOperand, opToken, type), 11454return _syntaxFactory.FieldExpression(this.EatContextualToken(SyntaxKind.FieldKeyword)); 11471return _syntaxFactory.ThisExpression(this.EatToken()); 11487return _syntaxFactory.LiteralExpression(SyntaxFacts.GetLiteralExpression(tk), this.EatToken()); 11518return this.AddError(_syntaxFactory.RefExpression(refKeyword, this.ParseExpressionCore()), ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk)); 11528var expr = _syntaxFactory.PredefinedType(this.EatToken()); 11568expr = _syntaxFactory.InvocationExpression(expr, this.ParseParenthesizedArgumentList()); 11572expr = _syntaxFactory.ElementAccessExpression(expr, this.ParseBracketedArgumentList()); 11577expr = _syntaxFactory.PostfixUnaryExpression(SyntaxFacts.GetPostfixUnaryExpression(this.CurrentToken.Kind), expr, this.EatToken()); 11583expr = _syntaxFactory.MemberAccessExpression( 11599expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.PointerMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11616return _syntaxFactory.MemberAccessExpression( 11621expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11627expr = _syntaxFactory.ConditionalAccessExpression( 11637expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, this.EatToken()); 11650return _syntaxFactory.BaseExpression(this.EatToken()); 11767SyntaxKind.DotToken => _syntaxFactory.MemberBindingExpression(this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)), 11768SyntaxKind.OpenBracketToken => _syntaxFactory.ElementBindingExpression(this.ParseBracketedArgumentList()), 11779expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, EatToken()); 11785expr = _syntaxFactory.InvocationExpression(expr, this.ParseParenthesizedArgumentList()); 11789expr = _syntaxFactory.ElementAccessExpression(expr, this.ParseBracketedArgumentList()); 11793expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 11799: _syntaxFactory.ConditionalAccessExpression( 11836return _syntaxFactory.ArgumentList(openToken, arguments, closeToken); 11852return _syntaxFactory.BracketedArgumentList(openToken, arguments, closeToken); 11964? _syntaxFactory.NameColon( 12001return _syntaxFactory.Argument(nameColon, refKindKeyword, expression); 12006return _syntaxFactory.TypeOfExpression( 12018return _syntaxFactory.DefaultExpression( 12026return _syntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression, keyword); 12032return _syntaxFactory.SizeOfExpression( 12041return _syntaxFactory.MakeRefExpression( 12050return _syntaxFactory.RefTypeExpression( 12063return _syntaxFactory.CheckedExpression( 12073return _syntaxFactory.RefValueExpression( 12268return _syntaxFactory.CastExpression( 12286_syntaxFactory.Argument(nameColon: null, refKindKeyword: null, expression)); 12294_syntaxFactory.Argument( 12295_syntaxFactory.NameColon((IdentifierNameSyntax)expression, EatToken()), 12300return _syntaxFactory.ParenthesizedExpression( 12317? _syntaxFactory.Argument(nameColon: null, refKindKeyword: null, expression: expression) 12318: _syntaxFactory.Argument( 12319_syntaxFactory.NameColon((IdentifierNameSyntax)expression, EatToken()), 12329list.Add(_syntaxFactory.Argument( 12334return _syntaxFactory.TupleExpression( 12685return _syntaxFactory.CollectionExpression( 12708? _syntaxFactory.SpreadElement(this.EatDotDotToken(), this.ParseExpressionCore()) 12709: _syntaxFactory.ExpressionElement(this.ParseExpressionCore()); 12735return _syntaxFactory.AnonymousObjectCreationExpression( 12744return _syntaxFactory.AnonymousObjectMemberDeclarator( 12790return _syntaxFactory.ArrayCreationExpression(@new, (ArrayTypeSyntax)type, initializer); 12808argumentList = _syntaxFactory.ArgumentList( 12815? _syntaxFactory.ImplicitObjectCreationExpression(@new, argumentList, initializer) 12816: _syntaxFactory.ObjectCreationExpression(@new, type, argumentList, initializer); 12860return _syntaxFactory.WithExpression( 12863_syntaxFactory.InitializerExpression( 12888return _syntaxFactory.InitializerExpression( 12959return _syntaxFactory.AssignmentExpression( 12970return _syntaxFactory.AssignmentExpression( 12972_syntaxFactory.ImplicitElementAccess(this.ParseBracketedArgumentList()), 12993return _syntaxFactory.InitializerExpression( 13038return _syntaxFactory.ImplicitArrayCreationExpression( 13059return _syntaxFactory.InitializerExpression( 13106return _syntaxFactory.ImplicitStackAllocArrayCreationExpression( 13115return _syntaxFactory.StackAllocArrayCreationExpression( 13163return _syntaxFactory.AnonymousMethodExpression( 13167_syntaxFactory.Block( 13175return _syntaxFactory.AnonymousMethodExpression( 13286return _syntaxFactory.ParenthesizedLambdaExpression( 13300var parameter = _syntaxFactory.Parameter( 13303return _syntaxFactory.SimpleLambdaExpression( 13332return _syntaxFactory.ParameterList( 13393return _syntaxFactory.Parameter( 13399? _syntaxFactory.EqualsValueClause(equalsToken, this.ParseExpressionCore()) 13558return _syntaxFactory.QueryExpression(fc, body); 13596_ => _syntaxFactory.SelectClause( 13601return _syntaxFactory.QueryBody( 13634return _syntaxFactory.FromClause( 13645return _syntaxFactory.JoinClause( 13658? _syntaxFactory.JoinIntoClause(ConvertToKeyword(this.EatToken()), this.ParseIdentifierToken()) 13665return _syntaxFactory.LetClause( 13675return _syntaxFactory.WhereClause( 13708return _syntaxFactory.OrderByClause( 13740return _syntaxFactory.Ordering(kind, expression, direction); 13746return _syntaxFactory.SelectClause( 13754return _syntaxFactory.GroupClause( 13764return _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(