public override void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) { FunctionDepth++; if (node.Body.IsKind(SyntaxKind.IdentifierName)) { var identifier = (IdentifierNameSyntax)node.Body; foreach (var assignmentNode in CacheAnalysisUtil.GetNullAssignmentNodes(identifier, _context)) { PossibleNullValues.Add(assignmentNode); } } base.VisitParenthesizedLambdaExpression(node); FunctionDepth--; }
public override void VisitIdentifierName(IdentifierNameSyntax node) { // Is this a method invocation expression (anonymous delegate)? var methodDeclNode = CacheAnalysisUtil.GetMethodDeclarationNode(node, _context); if (methodDeclNode != null) { _nullValueWalker.Visit(methodDeclNode); } // For visiting a non-literal variable // perform data-flow analysis var possibleNullAssignments = CacheAnalysisUtil.GetNullAssignmentNodes(node, _context); foreach (var assignment in possibleNullAssignments) { _hasPossibleNullValue = true; _possibleNullValues.Add(assignment); } base.VisitIdentifierName(node); }