Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static Print methods to ExpressionPrinter #29854

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

roji
Copy link
Member

@roji roji commented Dec 14, 2022

And some cleanup

Closes #29851

@roji roji requested a review from maumar December 14, 2022 10:31
@@ -386,7 +393,7 @@ protected override Expression VisitBlock(BlockExpression blockExpression)
}
}

var expressions = blockExpression.Result != null
var expressions = blockExpression.Expressions.Count > 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockExpression.Result is non-nullable, but does through for empty blocks (so this was a bug).

Expression expression,
int? characterLimit = null)
=> PrintCore(expression, characterLimit, verbose: false);
public virtual string PrintExpression(Expression expression, int? characterLimit = null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C# doesn't allow static/non-static overloading where the signature is otherwise the same. Since the static API is what we're likely to use in debugging (where shorter names are the most important), I'm proposing to have a static Print, and a longer non-static PrintExpression (which we'd use only in code).

@roji roji merged commit 3a62379 into dotnet:main Dec 14, 2022
@roji roji deleted the ExpressionPrinter branch December 14, 2022 12:07
roji added a commit to roji/efcore that referenced this pull request Jan 10, 2023
ghost pushed a commit that referenced this pull request Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query/MQ: consider making ExpressionPrinter static
2 participants