mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-26 20:22:28 +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)
|
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();
|
var targetExpression = _conditionalAccessExpressionsStack.Pop();
|
||||||
|
|
||||||
return _nullConditionalRewriteSupport switch {
|
return _nullConditionalRewriteSupport switch {
|
||||||
@@ -126,13 +123,13 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node)
|
return base.VisitMemberBindingExpression(node);
|
||||||
{
|
|
||||||
if (_conditionalAccessExpressionsStack.Count == 0)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Expected at least one conditional expression on the stack");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node)
|
||||||
|
{
|
||||||
|
if (_conditionalAccessExpressionsStack.Count > 0)
|
||||||
|
{
|
||||||
var targetExpression = _conditionalAccessExpressionsStack.Pop();
|
var targetExpression = _conditionalAccessExpressionsStack.Pop();
|
||||||
|
|
||||||
return _nullConditionalRewriteSupport switch {
|
return _nullConditionalRewriteSupport switch {
|
||||||
@@ -142,6 +139,9 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return base.VisitElementBindingExpression(node);
|
||||||
|
}
|
||||||
|
|
||||||
public override SyntaxNode? VisitThisExpression(ThisExpressionSyntax node)
|
public override SyntaxNode? VisitThisExpression(ThisExpressionSyntax node)
|
||||||
{
|
{
|
||||||
// Swap out the use of this to @this
|
// Swap out the use of this to @this
|
||||||
|
|||||||
Reference in New Issue
Block a user