mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-06-04 23:54:34 +00:00
Don't throw when out of accessible expressions
This commit is contained in:
@@ -112,11 +112,8 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
|
||||
public override SyntaxNode? VisitMemberBindingExpression(MemberBindingExpressionSyntax node)
|
||||
{
|
||||
if (_conditionalAccessExpressionsStack.Count == 0)
|
||||
if (_conditionalAccessExpressionsStack.Count > 0)
|
||||
{
|
||||
throw new InvalidOperationException("Expected at least one conditional expression on the stack");
|
||||
}
|
||||
|
||||
var targetExpression = _conditionalAccessExpressionsStack.Pop();
|
||||
|
||||
return _nullConditionalRewriteSupport switch {
|
||||
@@ -126,13 +123,13 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
};
|
||||
}
|
||||
|
||||
public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node)
|
||||
{
|
||||
if (_conditionalAccessExpressionsStack.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Expected at least one conditional expression on the stack");
|
||||
return base.VisitMemberBindingExpression(node);
|
||||
}
|
||||
|
||||
public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node)
|
||||
{
|
||||
if (_conditionalAccessExpressionsStack.Count > 0)
|
||||
{
|
||||
var targetExpression = _conditionalAccessExpressionsStack.Pop();
|
||||
|
||||
return _nullConditionalRewriteSupport switch {
|
||||
@@ -142,6 +139,9 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
};
|
||||
}
|
||||
|
||||
return base.VisitElementBindingExpression(node);
|
||||
}
|
||||
|
||||
public override SyntaxNode? VisitThisExpression(ThisExpressionSyntax node)
|
||||
{
|
||||
// Swap out the use of this to @this
|
||||
|
||||
Reference in New Issue
Block a user