internal static BoundStatement AddSequencePoint(UsingStatementSyntax usingSyntax, BoundStatement rewrittenStatement) { int start = usingSyntax.Span.Start; int end = usingSyntax.CloseParenToken.Span.End; TextSpan span = TextSpan.FromBounds(start, end); return new BoundSequencePointWithSpan(usingSyntax, rewrittenStatement, span); }
public LockChecks Start(SyntaxNodeAnalysisContext AnalysisContext,DiagnosticDescriptor rule) { this.analysisContext = AnalysisContext; this.usingStatement = (UsingStatementSyntax)analysisContext.Node; this.rule = rule; reportedIssue = false; return this; }
public sealed override void VisitUsingStatement(UsingStatementSyntax node) { if (node.Expression != null) { _builder.Add(node); } base.VisitUsingStatement(node); }
protected override void VisitUsingStatementDeclarations(UsingStatementSyntax node) { // Expecting one synthesized local for using statement with no explicit declaration. if (node.Declaration == null) { Debug.Assert(node.Expression != null); TryGetSlotIndex(SynthesizedLocalKind.Using); this.offset++; } }
public UsingStatementTranslation(UsingStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent) { Declaration = syntax.Declaration.Get<VariableDeclarationTranslation>(this); Expression = syntax.Expression.Get<ExpressionTranslation>(this); Statement = syntax.Statement.Get<StatementTranslation>(this); //if(Expression != null) //{ // throw new Exception("only support Declaration"); //} }
public UsingStatementTranslation(UsingStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent) { Declaration = syntax.Declaration.Get <VariableDeclarationTranslation>(this); Expression = syntax.Expression.Get <ExpressionTranslation>(this); Statement = syntax.Statement.Get <StatementTranslation>(this); //if(Expression != null) //{ // throw new Exception("only support Declaration"); //} }
public override SyntaxNode VisitUsingStatement(UsingStatementSyntax node) { if (ContainsEmbeddableUsingStatement(node)) { var block = (BlockSyntax)node.Statement; node = node.WithStatement(block.Statements[0]); } return(base.VisitUsingStatement(node)); }
public override SyntaxNode VisitUsingStatement(UsingStatementSyntax node) { if (node != this.ContainerOfStatementsOrFieldToReplace) { return(base.VisitUsingStatement(node)); } return(node.WithDeclaration(VisitNode(node.Declaration)) .WithExpression(VisitNode(node.Expression)) .WithStatement(ReplaceStatementIfNeeded(node.Statement))); }
public override void VisitUsingStatement(UsingStatementSyntax node) { VisitVariableDeclaration(node.Declaration); node.Statement.Accept(this); foreach (var decl in node.Declaration.Variables) { CodeBuilder.AppendFormat("{0}{1}:Dispose();", GetIndentString(), decl.Identifier.Text); CodeBuilder.AppendLine(); } }
private IStatement ConvertUsingStatement(UsingStatementSyntax usingStatement) { var ixst = new XUsingStatement(); ixst.Expression = usingStatement.Declaration != null? ConvertVariableDeclaration(usingStatement.Declaration) : ConvertExpression(usingStatement.Expression); ixst.Body = ConvertBlock(usingStatement.Statement); return(ixst); }
public static CSharpSyntaxNode DeclarationOrExpression(this UsingStatementSyntax usingStatement) { if (usingStatement == null) { throw new ArgumentNullException(nameof(usingStatement)); } CSharpSyntaxNode declaration = usingStatement.Declaration; return(declaration ?? usingStatement.Expression); }
private static bool PreservesSemantics( BlockSyntax parentBlock, UsingStatementSyntax outermostUsing, UsingStatementSyntax innermostUsing) { var statements = parentBlock.Statements; var index = statements.IndexOf(outermostUsing); return(UsingValueDoesNotLeakToFollowingStatements(statements, index) && UsingStatementDoesNotInvolveJumps(statements, index, innermostUsing)); }
protected override void VisitUsingStatementDeclarations(UsingStatementSyntax node) { // Expecting one temporary for using statement with no explicit declaration. if (node.Declaration == null) { var expr = node.Expression; Debug.Assert(expr != null); TryGetSlotIndex(TempKind.Using); this.offset++; } }
public static Task <Document> RefactorAsync( Document document, UsingStatementSyntax usingStatement, CancellationToken cancellationToken) { var rewriter = new SyntaxRewriter(); var newNode = (UsingStatementSyntax)rewriter.Visit(usingStatement) .WithFormatterAnnotation(); return(document.ReplaceNodeAsync(usingStatement, newNode, cancellationToken)); }
public static string UsingStatement(UsingStatementSyntax statement) { var output = SyntaxNode(statement.Declaration) + ";" + NewLine; output += Block((BlockSyntax)statement.Statement, false); //Swift calls deinit when you make a variable nil output += string.Join("", statement.Declaration.Variables.Select(variable => variable.Identifier.Text + " = nil;" + NewLine)); return(output); }
public override void VisitUsingStatement(UsingStatementSyntax node) { var tokens = new List <SyntaxToken>(); if (node.Declaration != null) { tokens.Add(node.Declaration.Identifier); } _tracker.AddIdentifiers(tokens); Visit(node.Statement); _tracker.RemoveIdentifiers(tokens); }
public override void VisitUsingStatement(UsingStatementSyntax node) { var declaration = node.Declaration; if (declaration != null) { foreach (var variable in declaration.Variables) { FindSpellingMistakesForIdentifier(variable.Identifier); } } base.VisitUsingStatement(node); }
public override void VisitUsingStatement(UsingStatementSyntax node) { var tokens = new List<SyntaxToken>(); if (node.Declaration != null) { tokens.AddRange(node.Declaration.Variables.Select(v => v.Identifier)); } tracker.AddIdentifiers(tokens); Visit(node.Statement); tracker.RemoveIdentifiers(tokens); }
public static bool ContainsEmbeddableUsingStatement(UsingStatementSyntax usingStatement) { if (usingStatement.Statement?.IsKind(SyntaxKind.Block) == true) { var block = (BlockSyntax)usingStatement.Statement; return(block.Statements.Count == 1 && block.Statements[0].IsKind(SyntaxKind.UsingStatement) && CheckTrivia(block, (UsingStatementSyntax)block.Statements[0])); } return(false); }
public static string UsingStatement(UsingStatementSyntax statement) { var output = SyntaxNode(statement.Declaration) + ";" + NewLine; output += Block((BlockSyntax)statement.Statement, false); //Swift calls deinit when you make a variable nil output += string.Join("", statement.Declaration.Variables.Select(variable => variable.Identifier.Text + " = nil;" + NewLine)); return output; }
private static IEnumerable <StatementSyntax> Expand(UsingStatementSyntax usingStatement) { var result = new List <StatementSyntax>(); Expand(result, usingStatement); for (int i = 0, n = result.Count; i < n; i++) { result[i] = result[i].WithAdditionalAnnotations(Formatter.Annotation); } return(result); }
public override void VisitUsingStatement(UsingStatementSyntax node) { if (entryNode is AnonymousFunctionExpressionSyntax && embeddedNode is AnonymousFunctionExpressionSyntax) { return; } if (_weComeFromMethod && _weInAnonymousMethod) { return; } InsertLLOCMap(node.GetLocation()); base.VisitUsingStatement(node); }
public override void VisitUsingStatement(UsingStatementSyntax node) { var tokens = new List <SyntaxToken>(); if (node.Declaration != null) { tokens.AddRange(node.Declaration.Variables.Select(v => v.Identifier)); } tracker.AddIdentifiers(tokens); Visit(node.Statement); tracker.RemoveIdentifiers(tokens); }
public static Doc Print(UsingStatementSyntax node) { var groupId = Guid.NewGuid().ToString(); var leadingTrivia = node.AwaitKeyword.Kind() != SyntaxKind.None ? Token.PrintLeadingTrivia(node.AwaitKeyword) : Token.PrintLeadingTrivia(node.UsingKeyword); var docs = new List <Doc> { ExtraNewLines.Print(node), leadingTrivia, Doc.Group( Token.PrintWithoutLeadingTrivia(node.AwaitKeyword), node.AwaitKeyword.Kind() != SyntaxKind.None ? " " : Doc.Null, node.AwaitKeyword.Kind() == SyntaxKind.None ? Token.PrintWithoutLeadingTrivia(node.UsingKeyword) : Token.Print(node.UsingKeyword), " ", Token.Print(node.OpenParenToken), Doc.GroupWithId( groupId, Doc.Indent( Doc.SoftLine, node.Declaration != null ? VariableDeclaration.Print(node.Declaration) : Doc.Null, node.Expression != null ? Node.Print(node.Expression) : Doc.Null ), Doc.SoftLine ), Token.Print(node.CloseParenToken), Doc.IfBreak(Doc.Null, Doc.SoftLine) ) }; if (node.Statement is UsingStatementSyntax) { docs.Add(Doc.HardLine, Node.Print(node.Statement)); } else if (node.Statement is BlockSyntax blockSyntax) { docs.Add(Block.PrintWithConditionalSpace(blockSyntax, groupId)); } else { docs.Add(Doc.Indent(Doc.HardLine, Node.Print(node.Statement))); } return(Doc.Concat(docs)); }
public static void ComputeRefactorings(RefactoringContext context, UsingStatementSyntax usingStatement) { if (context.IsRefactoringEnabled(RefactoringIdentifiers.IntroduceLocalVariable)) { ExpressionSyntax expression = usingStatement.Expression; if (expression != null) { context.RegisterRefactoring( IntroduceLocalVariableRefactoring.GetTitle(expression), cancellationToken => IntroduceLocalVariableRefactoring.RefactorAsync(context.Document, usingStatement, expression, cancellationToken)); } } }
public static async Task <Document> RefactorAsync( Document document, UsingStatementSyntax usingStatement, CancellationToken cancellationToken) { SyntaxNode oldRoot = await document.GetSyntaxRootAsync(cancellationToken); UsingStatementSyntax newNode = SyntaxRewriter.VisitNode(usingStatement) .WithAdditionalAnnotations(Formatter.Annotation); SyntaxNode newRoot = oldRoot.ReplaceNode(usingStatement, newNode); return(document.WithSyntaxRoot(newRoot)); }
public override void VisitUsingStatement(UsingStatementSyntax node) { if (!PreVisit(node)) { return; } node.Declaration?.Accept(this); node.Expression?.Accept(this); node.Statement?.Accept(this); base.VisitUsingStatement(node); PostVisit(node); }
public override object VisitUsingStatement(UsingStatementSyntax node) { if (node.Declaration != null) { AnalyzeDeclaration(node.Declaration); } if (node.Expression != null) { var analysisExpression = expressionsVisitor.Visit(node.Expression); } Visit(node.Statement); return(null); }
private void BuildUsingStatement(UsingStatementSyntax usingStatement) { currentBlock = CreateBlock(currentBlock); BuildStatement(usingStatement.Statement); currentBlock = CreateJumpBlock(usingStatement, currentBlock); if (usingStatement.Expression != null) { BuildExpression(usingStatement.Expression); } else { BuildVariableDeclaration(usingStatement.Declaration); } }
public override void VisitUsingStatement(UsingStatementSyntax node) { ThrowIfCancellationRequested(); if (_insideConnectionScope) { base.VisitUsingStatement(node); } else { _insideConnectionScope = node.Accept(_connectionScopeVisitor); base.VisitUsingStatement(node); _insideConnectionScope = false; } }
public override void VisitUsingStatement(UsingStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } Todo("UsingStatement"); var nl = OurLine.NewLine(LineKind.Decl, "UsingStatement"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("UsingStatement"); base.VisitUsingStatement(node); EndBlock("UsingStatement"); }
private static async Task <Document> AddUsingStatementAsync( Document document, LocalDeclarationStatementSyntax localDeclaration, CancellationToken cancellationToken) { SyntaxNode oldRoot = await document.GetSyntaxRootAsync(cancellationToken); UsingStatementSyntax usingStatement = SyntaxFactory .UsingStatement(localDeclaration.Declaration.WithoutTrivia(), null, SyntaxFactory.Block()) .WithTriviaFrom(localDeclaration) .WithAdditionalAnnotations(Formatter.Annotation); SyntaxNode newRoot = oldRoot.ReplaceNode(localDeclaration, usingStatement); return(document.WithSyntaxRoot(newRoot)); }
public static SyntaxNode DeclarationOrExpression(this UsingStatementSyntax usingStatement) { if (usingStatement == null) { throw new ArgumentNullException(nameof(usingStatement)); } if (usingStatement.Declaration != null) { return(usingStatement.Declaration); } else { return(usingStatement.Expression); } }
public override void VisitUsingStatement(UsingStatementSyntax node) { if (entryPoint.IsMethodLevel() && node.IsParent <AnonymousFunctionExpressionSyntax>()) { return; } if (node.Statement.Kind() != SyntaxKind.UsingStatement) { return; } IncreaseHeight(); EmbeddednessConsideredToIncrease(); base.VisitUsingStatement(node); currentNL--; EmbeddednessConsideredToDecrease(); }
public static void Analyze(SyntaxNodeAnalysisContext context, UsingStatementSyntax usingStatement) { if (ContainsEmbeddableUsingStatement(usingStatement) && !usingStatement .Ancestors() .Any(f => f.IsKind(SyntaxKind.UsingStatement) && ContainsEmbeddableUsingStatement((UsingStatementSyntax)f))) { var block = (BlockSyntax)usingStatement.Statement; context.ReportDiagnostic( DiagnosticDescriptors.SimplifyNestedUsingStatement, block); context.ReportBraces(DiagnosticDescriptors.SimplifyNestedUsingStatementFadeOut, block); } }
private static SyntaxTriviaList Expand( List <StatementSyntax> result, UsingStatementSyntax usingStatement ) { // First, convert the using-statement into a using-declaration. result.Add(Convert(usingStatement)); switch (usingStatement.Statement) { case BlockSyntax blockSyntax: var statements = blockSyntax.Statements; var openBraceTrailingTrivia = blockSyntax.OpenBraceToken.TrailingTrivia; if (openBraceTrailingTrivia.Any(t => t.IsSingleOrMultiLineComment())) { var newFirstStatement = statements .First() .WithPrependedLeadingTrivia(openBraceTrailingTrivia); statements = statements.Replace(statements.First(), newFirstStatement); } var closeBraceTrailingTrivia = blockSyntax.CloseBraceToken.TrailingTrivia; if (closeBraceTrailingTrivia.Any(t => t.IsSingleOrMultiLineComment())) { var newLastStatement = statements .Last() .WithAppendedTrailingTrivia(closeBraceTrailingTrivia); statements = statements.Replace(statements.Last(), newLastStatement); } // if we hit a block, then inline all the statements in the block into // the final list of statements. result.AddRange(statements); return(blockSyntax.CloseBraceToken.LeadingTrivia); case UsingStatementSyntax childUsing when childUsing.Declaration != null: // If we have a directly nested using-statement, then recurse into that // expanding it and handle its children as well. return(Expand(result, childUsing)); case StatementSyntax anythingElse: // Any other statement should be untouched and just be placed next in the // final list of statements. result.Add(anythingElse); return(default); } return(default);
public static void Go(OutputWriter writer, UsingStatementSyntax usingStatement) { var expression = usingStatement.Expression; writer.WriteLine("//using block ... " + usingStatement.Declaration); writer.OpenBrace(); //Ensure the using statement is a local variable - we can't deal with things we can't reliably repeat in the finally block var resource = Utility.TryGetIdentifier(expression); // if (resource == null) // throw new Exception("Using statements must reference a local variable. " + Utility.Descriptor(usingStatement)); var variables = new SeparatedSyntaxList<VariableDeclaratorSyntax>();//.Select(o => o.Identifier.ValueText); if (usingStatement.Declaration != null) { Core.Write(writer, usingStatement.Declaration); variables = usingStatement.Declaration.Variables; } writer.WriteLine("try"); Core.WriteStatementAsBlock(writer, usingStatement.Statement); writer.WriteLine("finally"); writer.OpenBrace(); foreach (var variable in variables) { var typeInfo = TypeProcessor.GetTypeInfo(usingStatement.Declaration.Type); if (!typeInfo.Type.IsValueType) writer.WriteLine("if(" + variable.Identifier.Text + " !is null)"); else if (typeInfo.Type.Name == "Nullable") writer.WriteLine("if(" + variable.Identifier.Text + ".HasValue)"); writer.WriteLine(variable.Identifier.Text + ".Dispose(cast(IDisposable)null);"); } if (resource != null) { writer.WriteLine("if(" + resource + " !is null)"); writer.WriteLine(resource + ".Dispose(cast(IDisposable)null);"); } writer.CloseBrace(); writer.CloseBrace(); }
static CodeAction HandleUsingStatement(Document document, Microsoft.CodeAnalysis.Text.TextSpan span, SyntaxNode root, UsingStatementSyntax usingStatement, VariableDeclaratorSyntax variable) { return CodeActionFactory.Create( span, DiagnosticSeverity.Info, "Iterate via 'foreach'", ct => { ForEachStatementSyntax foreachStmt = BuildForeach(SyntaxFactory.IdentifierName(variable.Identifier)); var innerBlock = usingStatement.Statement.EnsureBlock(); var newBlock = innerBlock.WithStatements(innerBlock.Statements.Insert(0, foreachStmt)).WithAdditionalAnnotations(Formatter.Annotation); var newUsing = usingStatement.WithStatement(newBlock); var newRoot = root.ReplaceNode(usingStatement, newUsing.WithTrailingTrivia(usingStatement.GetTrailingTrivia())); return Task.FromResult(document.WithSyntaxRoot(newRoot)); } ); }
public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeActionInNonGenerated( (System.Action<SyntaxNodeAnalysisContext>) ( c => { reportedIssue = false; analysisContext = (SyntaxNodeAnalysisContext)c; usingStatement = (UsingStatementSyntax)c.Node; var lockChecks = new LockChecks(); lockChecks.Start(c, Rule); if (!lockChecks.isLock()) { return; } SyntaxNode block = lockChecks.GetUsingBlock(ref c); lockChecks.LockCheckinSimpleMemberAccess(block); /* IfStatementSyntax firstIfStatement = lockChecks.GetFirstIfStatementInUsingBlock(block); lockChecks.CheckExpressionIsNotLockApplied(firstIfStatement); SyntaxNode ifAppliedNode = lockChecks.CheckIfStatementNotEmpty(firstIfStatement); lockChecks.CheckReturnOrThrow( ifAppliedNode); if (!"false".Equals((string)((ReturnStatementSyntax)returnStatement).Expression.ToString())) { var diagnostic = Diagnostic.Create(Rule, returnStatement.GetLocation(), "does not return literal false"); c.ReportDiagnostic(diagnostic); return; } */ }), SyntaxKind.UsingStatement ); }
public override void VisitUsingStatement(UsingStatementSyntax node) { Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); var usingBinder = new UsingStatementBinder(_enclosing, node); AddToMap(node, usingBinder); ExpressionSyntax expressionSyntax = node.Expression; VariableDeclarationSyntax declarationSyntax = node.Declaration; Debug.Assert((expressionSyntax == null) ^ (declarationSyntax == null)); // Can't have both or neither. if (expressionSyntax != null) { Visit(expressionSyntax, usingBinder); } else { foreach (VariableDeclaratorSyntax declarator in declarationSyntax.Variables) { Visit(declarator, usingBinder); } } VisitPossibleEmbeddedStatement(node.Statement, usingBinder); }
public UsingStatementBinder(Binder enclosing, UsingStatementSyntax syntax) : base(enclosing) { _syntax = syntax; }
public override SyntaxNode VisitUsingStatement(UsingStatementSyntax node) { this.AppendCompileIssue(node, IssueType.Error, IssueId.UsingNotSupport); return node; }
private IEnumerable<ITypeSymbol> InferTypeInUsingStatement(UsingStatementSyntax usingStatement, SyntaxToken? previousToken = null) { // If we have a position, it has to be after "using(" if (previousToken.HasValue && previousToken.Value != usingStatement.OpenParenToken) { return SpecializedCollections.EmptyEnumerable<ITypeSymbol>(); } return SpecializedCollections.SingletonEnumerable(this.Compilation.GetSpecialType(SpecialType.System_IDisposable)); }
/// <summary> /// Handles the given using statement. /// </summary> /// <param name="stmt">Statement</param> /// <param name="successor">Successor</param> private void HandleUsingStatement(UsingStatementSyntax stmt, ControlFlowGraphNode successor) { this.SyntaxNodes.Add(stmt.Declaration); this.IsJumpNode = true; var usingNode = new ControlFlowGraphNode(this.Summary); this.ISuccessors.Add(usingNode); usingNode.IPredecessors.Add(this); if (stmt.Statement is BlockSyntax) { usingNode.Construct((stmt.Statement as BlockSyntax).Statements, 0, false, successor); } else { usingNode.Construct(new SyntaxList<StatementSyntax> { stmt.Statement }, 0, false, successor); } }
private BoundStatement BindUsingStatement(UsingStatementSyntax node, DiagnosticBag diagnostics) { var usingBinder = this.GetBinder(node); Debug.Assert(usingBinder != null); return usingBinder.BindUsingStatementParts(diagnostics, usingBinder); }
public override void VisitUsingStatement(UsingStatementSyntax node) { if (node.Declaration != null) { AddVariableExpressions(node.Declaration.Variables, _expressions); } AddExpressionTerms(node.Expression, _expressions); }
public UsingStatementBinder(MethodSymbol owner, Binder enclosing, UsingStatementSyntax syntax) : base(owner, enclosing) { this.syntax = syntax; this.expressionHandler = syntax.Expression == null ? null : new LockOrUsingStatementExpressionHandler(syntax.Expression, this); }
protected override void VisitUsingStatementDeclarations(UsingStatementSyntax node) { // Expecting one temporary for using statement with no explicit declaration. if (node.Declaration == null) { var expr = node.Expression; Debug.Assert(expr != null); TryGetSlotIndex(TempKind.Using); this.offset++; } }
/// <summary> /// /// </summary> /// <param name="node"></param> /// <remarks> /// Statements will cause an AST walker to be created, thus we don't need to go further deeper in the /// tree by visiting the node. /// </remarks> public override void VisitUsingStatement(UsingStatementSyntax node) { this.VisitStatement(node); }
private static bool AreEquivalentActiveStatements(UsingStatementSyntax oldNode, UsingStatementSyntax newNode) { // only check the expression/declaration, edits in the body are allowed: return AreEquivalentIgnoringLambdaBodies( (SyntaxNode)oldNode.Declaration ?? oldNode.Expression, (SyntaxNode)newNode.Declaration ?? newNode.Expression); }
public override void VisitUsingStatement(UsingStatementSyntax node) { var saveCurrentScope = currentScope; currentScope = new DeclarationScope(currentScope); if (node.Declaration != null) { foreach (VariableDeclaratorSyntax declarator in node.Declaration.Variables) { builder.Add(new SemanticModelInfo(currentScope, declarator)); Visit(declarator.Initializer); } } Visit(node.Expression); VisitPossibleEmbeddedStatement(node.Statement); Debug.Assert(currentScope.Parent == saveCurrentScope); currentScope = saveCurrentScope; }
public sealed override void VisitUsingStatement(UsingStatementSyntax node) { this.VisitUsingStatementDeclarations(node); base.VisitUsingStatement(node); }
public void VisitUsingStatement(UsingStatementSyntax node) { if (node == null) throw new ArgumentNullException("node"); node.Validate(); WriteLeadingTrivia(node); _writer.WriteIndent(); _writer.WriteKeyword(PrinterKeyword.Using); if (_writer.Configuration.Spaces.BeforeParentheses.UsingParentheses) _writer.WriteSpace(); _writer.WriteSyntax(Syntax.OpenParen); if (_writer.Configuration.Spaces.WithinParentheses.UsingParentheses) _writer.WriteSpace(); if (node.Expression != null) node.Expression.Accept(this); if (node.Declaration != null) node.Declaration.Accept(this); if (_writer.Configuration.Spaces.WithinParentheses.UsingParentheses) _writer.WriteSpace(); _writer.WriteSyntax(Syntax.CloseParen); if ( _writer.Configuration.Other.Other.IndentNestedUsingStatements && node.Statement is UsingStatementSyntax ) { _writer.WriteLine(); node.Statement.Accept(this); } else { VisitBlockStatement(node.Statement); } WriteTrailingTrivia(node); }
protected override void VisitUsingStatementDeclarations(UsingStatementSyntax node) { if (node.Declaration == null) { var expr = node.Expression; Debug.Assert(expr != null); this.builder.Add(expr); } }
protected override void VisitUsingStatementDeclarations(UsingStatementSyntax node) { // Expecting one synthesized local for using statement with no explicit declaration. if (node.Declaration == null) { Debug.Assert(node.Expression != null); TryGetSlotIndex(SynthesizedLocalKind.Using); this.offset++; } }
public override void VisitUsingStatement(UsingStatementSyntax node) { var usingBinder = new UsingStatementBinder(this.method, enclosing, node); AddToMap(node, usingBinder); VisitPossibleEmbeddedStatement(node.Statement, usingBinder); }
public override void VisitUsingStatement(UsingStatementSyntax node) { Debug.Assert((object)_method == _enclosing.ContainingMemberOrLambda); var usingBinder = new UsingStatementBinder(_enclosing, node); AddToMap(node, usingBinder); VisitPossibleEmbeddedStatement(node.Statement, usingBinder); }
protected abstract void VisitUsingStatementDeclarations(UsingStatementSyntax node);
private bool AnalyzeUsingStatement(UsingStatementSyntax usingStatement) => !usingStatement.Statement.IsKind(SyntaxKind.Block) && !usingStatement.Statement.IsKind(SyntaxKind.UsingStatement);
public override void VisitUsingStatement(UsingStatementSyntax node) { base.VisitUsingStatement(node); _counter++; }