private RegionAnalysisContext RegionAnalysisContext(StatementSyntax firstStatement, StatementSyntax lastStatement) { var memberModel = GetMemberModel(firstStatement); if (memberModel == null) { // Recover from error cases var node = new BoundBadStatement(firstStatement, ImmutableArray <BoundNode> .Empty, hasErrors: true); return(new RegionAnalysisContext(Compilation, null, node, node, node)); } Symbol member; BoundNode boundNode = GetBoundRoot(memberModel, out member); var first = memberModel.GetUpperBoundNode(firstStatement, promoteToBindable: true); var last = memberModel.GetUpperBoundNode(lastStatement, promoteToBindable: true); return(new RegionAnalysisContext(Compilation, member, boundNode, first, last)); }
private RegionAnalysisContext RegionAnalysisContext(ExpressionSyntax expression) { while (expression.Kind() == SyntaxKind.ParenthesizedExpression) { expression = ((ParenthesizedExpressionSyntax)expression).Expression; } var memberModel = GetMemberModel(expression); if (memberModel == null) { // Recover from error cases var node = new BoundBadStatement(expression, ImmutableArray <BoundNode> .Empty, hasErrors: true); return(new RegionAnalysisContext(Compilation, null, node, node, node)); } Symbol member; BoundNode boundNode = GetBoundRoot(memberModel, out member); var first = memberModel.GetUpperBoundNode(expression, promoteToBindable: true); var last = first; return(new RegionAnalysisContext(this.Compilation, member, boundNode, first, last)); }