Exemplo n.º 1
0
 private void HandleBaseMethodDeclaration(BaseMethodDeclarationSyntax node)
 {
     // Roughly, set up a new block context, descent and then pop that context again.
     _blockGuardInformation = new BlockGuardInformation(_graph);
     Visit(node.Body);
     _blockGuardInformation = null;
 }
Exemplo n.º 2
0
 private void HandleConditionalBlock(IEnumerable <SyntaxNode> bodyNodes, SyntaxNode validatedGuard = null, SyntaxNode invalidatedGuard = null)
 {
     // Roughly, set up a new block context with condition, descent and then pop that context again.
     _blockGuardInformation = new BlockGuardInformation(_graph, enclosingBlockInfo: _blockGuardInformation,
                                                        validatedGuard: validatedGuard, invalidatedGuard: invalidatedGuard);
     foreach (var bodyNode in bodyNodes)
     {
         Visit(bodyNode);
     }
     _blockGuardInformation = _blockGuardInformation.EnclosingBlockInformation;
 }
Exemplo n.º 3
0
 public override void VisitForEachStatement(ForEachStatementSyntax node)
 {
     Visit(node.Expression);
     if (_graph.VariableUseNodes.Contains(node.Identifier))
     {
         // This is a special case required because ForEachStatements require a raw identifier
         // token (but matches what HandleConditionalBlock does):
         _blockGuardInformation = new BlockGuardInformation(_graph, enclosingBlockInfo: _blockGuardInformation,
                                                            validatedGuard: node.Expression, invalidatedGuard: null);
         VisitVariable(node.Identifier);
         _blockGuardInformation = _blockGuardInformation.EnclosingBlockInformation;
     }
     HandleConditionalBlock(new SyntaxNode[] { node.Statement }, validatedGuard: node.Expression);
 }