C#: Unary expression cleanup in the extractor.#21845
Open
michaelnebel wants to merge 3 commits into
Open
Conversation
ae8245b to
30a5769
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors unary expression extraction in the C# extractor by splitting prefix and postfix unary handling and avoiding extracting operator-call metadata unless the expression is actually an OPERATOR_INVOCATION.
Changes:
- Replace the generic
Unaryextractor entity with a dedicatedPrefixUnaryentity. - Simplify
PostfixUnaryby usingPostfixUnaryExpressionSyntaxdirectly and extracting the operand fromSyntax.Operand. - Only emit
expr_call/dynamic_member_nameoperator-call data whenKind == ExprKind.OPERATOR_INVOCATION.
Show a summary per file
| File | Description |
|---|---|
| csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Unary.cs | Removed legacy prefix-unary extractor implementation (superseded by PrefixUnary). |
| csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/PrefixUnary.cs | New dedicated prefix unary entity; gates operator-call extraction on OPERATOR_INVOCATION. |
| csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/PostfixUnary.cs | Uses PostfixUnaryExpressionSyntax and gates operator-call extraction similarly. |
| csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Factory.cs | Routes prefix unary syntax kinds to PrefixUnary and updates postfix unary construction calls. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we
DCA
cs/invalid-dynamic-call. However, in C#: Improve dataflow for mutation definition and mutation operator calls. #21839 we saw that a similar result was removed. I suspect this is due to wobliness.