185 references to UsingStatementSyntax
Microsoft.CodeAnalysis.CSharp (26)
Binder\Binder_Statements.cs (2)
131result = BindUsingStatement((UsingStatementSyntax)node, diagnostics); 307private BoundStatement BindUsingStatement(UsingStatementSyntax node, BindingDiagnosticBag diagnostics)
Binder\LocalBinderFactory.cs (1)
547public override void VisitUsingStatement(UsingStatementSyntax node)
Binder\UsingStatementBinder.cs (2)
19private readonly UsingStatementSyntax _syntax; 21public UsingStatementBinder(Binder enclosing, UsingStatementSyntax syntax)
Lowering\Instrumentation\DebugInfoInjector.cs (1)
450return AddSequencePoint((UsingStatementSyntax)original.Syntax,
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (1)
40internal static BoundStatement AddSequencePoint(UsingStatementSyntax usingSyntax, BoundStatement rewrittenStatement)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (3)
51SyntaxToken awaitKeyword = node.Syntax.Kind() == SyntaxKind.UsingStatement ? ((UsingStatementSyntax)node.Syntax).AwaitKeyword : default; 152UsingStatementSyntax usingSyntax = (UsingStatementSyntax)node.Syntax;
Parser\LanguageParser.cs (1)
9880private UsingStatementSyntax ParseUsingStatement(SyntaxList<AttributeListSyntax> attributes, SyntaxToken awaitTokenOpt = null)
Symbols\LocalDeclarationKind.cs (1)
38/// User defined local variable declared by <see cref="VariableDeclarationSyntax"/> in <see cref="UsingStatementSyntax"/>.
Syntax\LookupPosition.cs (2)
359return ((UsingStatementSyntax)statement).UsingKeyword; 435return GetFirstExcludedToken(((UsingStatementSyntax)statement).Statement);
Syntax\SyntaxBindingUtilities.cs (4)
17or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } } 18or UsingStatementSyntax { Expression: not null, AwaitKeyword.RawKind: not 0 }; 21=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } } 22or UsingStatementSyntax { Expression: not null }
Syntax\SyntaxFacts.cs (1)
554case UsingStatementSyntax @using when @using.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword):
Syntax\SyntaxNormalizer.cs (2)
1362if (node is UsingStatementSyntax { Parent: UsingStatementSyntax })
Syntax\UsingStatementSyntax.cs (5)
11public UsingStatementSyntax Update(SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 14public UsingStatementSyntax Update(SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 23public static UsingStatementSyntax UsingStatement(SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 26public static UsingStatementSyntax UsingStatement(SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 29public static UsingStatementSyntax UsingStatement(VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, StatementSyntax statement)
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (12)
84var outermostUsing = (UsingStatementSyntax)context.Node; 95var innermostUsing = outermostUsing; 99for (var current = outermostUsing; current != null; current = current.Statement as UsingStatementSyntax) 134UsingStatementSyntax outermostUsing, 135UsingStatementSyntax innermostUsing, 148for (var current = outermostUsing; current != null; current = current.Statement as UsingStatementSyntax) 177UsingStatementSyntax outermostUsing, 178UsingStatementSyntax innermostUsing, 189IReadOnlyList<StatementSyntax> parentStatements, int index, UsingStatementSyntax innermostUsing)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
150(nodeParent is UsingStatementSyntax usingStatement && usingStatement.Expression == node) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
124UsingStatementSyntax or 139UsingStatementSyntax n => n.Statement, 711UsingStatementSyntax n => (n.OpenParenToken, n.CloseParenToken),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (2)
298UsingStatementSyntax usingStatement => usingStatement.CloseParenToken.Equals(token), 368UsingStatementSyntax or
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
331if (node is UsingStatementSyntax usingStatement && usingStatement.Statement != null && !(usingStatement.Statement is BlockSyntax || usingStatement.Statement is UsingStatementSyntax))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (13)
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
79case UsingStatementSyntax usingStatement:
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (8)
50d => (UsingStatementSyntax)d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken)).ToSet(); 68ISet<UsingStatementSyntax> topmostUsingStatements) 78if (statementToUpdate is UsingStatementSyntax usingStatement && 103UsingStatementSyntax usingStatement, 118private static ImmutableArray<StatementSyntax> Expand(UsingStatementSyntax usingStatement) 136private static SyntaxTriviaList Expand(ArrayBuilder<StatementSyntax> result, UsingStatementSyntax usingStatement) 186case UsingStatementSyntax childUsing when childUsing.Declaration != null: 199static LocalDeclarationStatementSyntax Convert(UsingStatementSyntax usingStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
127if (node is UsingStatementSyntax usingStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
182UsingStatementSyntax usingStatement => InferTypeInUsingStatement(usingStatement), 249UsingStatementSyntax usingStatement => InferTypeInUsingStatement(usingStatement, token), 2163private IEnumerable<TypeInferenceInfo> InferTypeInUsingStatement(UsingStatementSyntax usingStatement, SyntaxToken? previousToken = null)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (5)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
332or UsingStatementSyntax
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (4)
151WhileStatementSyntax or ForEachStatementSyntax or ForStatementSyntax or LockStatementSyntax or UsingStatementSyntax 482UsingStatementSyntax usingStatementNode => ShouldAddBraceForUsingStatement(usingStatementNode, caretPosition), 721private static bool ShouldAddBraceForUsingStatement(UsingStatementSyntax usingStatementNode, int caretPosition) 950UsingStatementSyntax usingStatementNode => usingStatementNode.WithStatement(block),
Microsoft.CodeAnalysis.CSharp.Features (53)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
392modifierGetter: v => v.Parent is UsingStatementSyntax or ForStatementSyntax
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
74public override void VisitUsingStatement(UsingStatementSyntax node)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
295AddLastStatementOfConstruct((statement as UsingStatementSyntax).Statement);
EditAndContinue\BreakpointSpans.cs (2)
694var usingStatement = (UsingStatementSyntax)statement;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (11)
794if (oldStatement.Parent is UsingStatementSyntax oldUsing) 796return newStatement.Parent is UsingStatementSyntax newUsing && 833return AreEquivalentActiveStatements((UsingStatementSyntax)oldStatement, (UsingStatementSyntax)newStatement); 889private static bool AreEquivalentActiveStatements(UsingStatementSyntax oldNode, UsingStatementSyntax newNode) 1767var usingStatement = (UsingStatementSyntax)node; 2673/// <see cref="UsingStatementSyntax"/> and using <see cref="LocalDeclarationStatementSyntax"/> generate finally blocks, 3028ReportUnmatchedStatements<UsingStatementSyntax>( 3037nodeSelector: static n => n is UsingStatementSyntax { Declaration: null } usingStatement,
EditAndContinue\SyntaxComparer.cs (5)
394return node is UsingStatementSyntax { Declaration: not null } ? Label.UsingStatementWithDeclarations : Label.UsingStatementWithExpression; 803var leftUsing = (UsingStatementSyntax)leftNode; 804var rightUsing = (UsingStatementSyntax)rightNode;
EditAndContinue\SyntaxUtilities.cs (1)
238/// <see cref="UsingStatementSyntax"/> for await using statements.
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
203public override SyntaxNode VisitUsingStatement(UsingStatementSyntax node)
ExtractMethod\CSharpSelectionValidator.Validator.cs (2)
38UsingStatementSyntax or 72UsingStatementSyntax or
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
75UsingStatementSyntax usingStatement => TryAddAsyncOrAwaitKeyword(usingStatement.AwaitKeyword, spans),
Highlighting\KeywordHighlighters\UsingStatementHighlighter.cs (2)
19internal class UsingStatementHighlighter : AbstractKeywordHighlighter<UsingStatementSyntax> 27protected override void AddHighlights(UsingStatementSyntax usingStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (12)
84var outermostUsing = (UsingStatementSyntax)context.Node; 95var innermostUsing = outermostUsing; 99for (var current = outermostUsing; current != null; current = current.Statement as UsingStatementSyntax) 134UsingStatementSyntax outermostUsing, 135UsingStatementSyntax innermostUsing, 148for (var current = outermostUsing; current != null; current = current.Statement as UsingStatementSyntax) 177UsingStatementSyntax outermostUsing, 178UsingStatementSyntax innermostUsing, 189IReadOnlyList<StatementSyntax> parentStatements, int index, UsingStatementSyntax innermostUsing)
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
79case UsingStatementSyntax usingStatement:
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (8)
50d => (UsingStatementSyntax)d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken)).ToSet(); 68ISet<UsingStatementSyntax> topmostUsingStatements) 78if (statementToUpdate is UsingStatementSyntax usingStatement && 103UsingStatementSyntax usingStatement, 118private static ImmutableArray<StatementSyntax> Expand(UsingStatementSyntax usingStatement) 136private static SyntaxTriviaList Expand(ArrayBuilder<StatementSyntax> result, UsingStatementSyntax usingStatement) 186case UsingStatementSyntax childUsing when childUsing.Declaration != null: 199static LocalDeclarationStatementSyntax Convert(UsingStatementSyntax usingStatement)
src\Compilers\CSharp\Portable\Syntax\SyntaxBindingUtilities.cs (4)
17or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } } 18or UsingStatementSyntax { Expression: not null, AwaitKeyword.RawKind: not 0 }; 21=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } } 22or UsingStatementSyntax { Expression: not null }
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (18)
IOperation\IOperationTests_IUsingStatement.cs (18)
72VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 126VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source + s_IAsyncEnumerable + IOperationTests_IForEachLoopStatement.s_ValueTask, expectedOperationTree, expectedDiagnostics); 185VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source + IOperationTests_IForEachLoopStatement.s_ValueTask, expectedOperationTree, expectedDiagnostics); 244VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source + s_IAsyncEnumerable + IOperationTests_IForEachLoopStatement.s_ValueTask, expectedOperationTree, expectedDiagnostics); 614VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 662VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 745VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 806VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 884VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1055VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1104VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1139VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1177VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1224VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1253VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1462VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1525VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1577VerifyOperationTreeAndDiagnosticsForTest<UsingStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Semantics\UsingStatementTests.cs (9)
60var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1341var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1376var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1865var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1881var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1894var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\GetSemanticInfoBrokenCodeTests.cs (2)
224var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (19)
Generated\Syntax.Test.xml.Generated.cs (5)
10622private static UsingStatementSyntax GenerateUsingStatement() 12553var node = GenerateUsingStatement(); 12563var newNode = node.WithAttributeLists(node.AttributeLists).WithAwaitKeyword(node.AwaitKeyword).WithUsingKeyword(node.UsingKeyword).WithOpenParenToken(node.OpenParenToken).WithDeclaration(node.Declaration).WithExpression(node.Expression).WithCloseParenToken(node.CloseParenToken).WithStatement(node.Statement); 17505var oldNode = GenerateUsingStatement(); 17521var oldNode = GenerateUsingStatement();
Parsing\StatementParsingTests.cs (14)
2344var us = (UsingStatementSyntax)statement; 2366var us = (UsingStatementSyntax)statement; 2459var us = (UsingStatementSyntax)statement; 2799var us = (UsingStatementSyntax)statement; 2924var us = (UsingStatementSyntax)statement; 3007var us = (UsingStatementSyntax)statement; 3079var us = (UsingStatementSyntax)statement;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
LocalVariableDeclaratorsCollector.cs (1)
44public sealed override void VisitUsingStatement(UsingStatementSyntax node)
Microsoft.CodeAnalysis.CSharp.Workspaces (13)
Rename\LocalConflictVisitor.cs (1)
84public override void VisitUsingStatement(UsingStatementSyntax node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
150(nodeParent is UsingStatementSyntax usingStatement && usingStatement.Expression == node) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
124UsingStatementSyntax or 139UsingStatementSyntax n => n.Statement, 711UsingStatementSyntax n => (n.OpenParenToken, n.CloseParenToken),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (2)
298UsingStatementSyntax usingStatement => usingStatement.CloseParenToken.Equals(token), 368UsingStatementSyntax or
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
331if (node is UsingStatementSyntax usingStatement && usingStatement.Statement != null && !(usingStatement.Statement is BlockSyntax || usingStatement.Statement is UsingStatementSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
127if (node is UsingStatementSyntax usingStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
182UsingStatementSyntax usingStatement => InferTypeInUsingStatement(usingStatement), 249UsingStatementSyntax usingStatement => InferTypeInUsingStatement(usingStatement, token), 2163private IEnumerable<TypeInferenceInfo> InferTypeInUsingStatement(UsingStatementSyntax usingStatement, SyntaxToken? previousToken = null)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SyntaxGeneratorTests.cs (3)
640VerifySyntax<UsingStatementSyntax>( 644VerifySyntax<UsingStatementSyntax>( 648VerifySyntax<UsingStatementSyntax>(
Microsoft.CodeAnalysis.Test.Utilities (2)
Compilation\ControlFlowGraphVerifier.cs (2)
1125if (syntax.Parent?.Parent is CSharp.Syntax.UsingStatementSyntax usingStmt && 1164if (((CSharp.Syntax.UsingStatementSyntax)parent).Expression == syntax)
Microsoft.VisualStudio.LanguageServices.CSharp (1)
LanguageService\CSharpHelpContextService.cs (1)
506if (token.IsKind(SyntaxKind.UsingKeyword) && token.Parent is UsingStatementSyntax or LocalDeclarationStatementSyntax)