Skip to content
New issue

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

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

Already on GitHub? # to your account

Change value tracking to verify a parameter is used when mapping from that parameter to it's callers #76318

Merged
merged 5 commits into from
Dec 7, 2024

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Dec 7, 2024

Change the value tracking code such that parameters only add callers that specify that parameter as an argument.

Fixes #66771

Change the value tracking code such that parameters only add callers that specify that parameter as an argument.
@ToddGrun ToddGrun requested a review from a team as a code owner December 7, 2024 03:15
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 7, 2024
if (syntaxFacts.IsArgument(descendantNode))
{
// Ensure this is an argument to the requested invocation
if (invocationSyntax != descendantNode.FirstAncestorOrSelf<SyntaxNode>(syntaxFacts.IsInvocationExpression))
Copy link
Member

Choose a reason for hiding this comment

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

this isn't a great way to do things. consider using ISyntaxFacts which will letyou decompose things in a language agnostic fashino, while still being:

  1. somewhat strongly typed.
  2. ensuring you don't have code that is waslking down infinitely deep and all the way back up again.

Copy link
Member

Choose a reason for hiding this comment

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

another approach is to simply use IOp to get the IInvocationOp for your invocation. Then find the IArg corresponding to your parameter. And then just see if it is .Implicit or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I was making this too complicated. As you mentioned IInvocationOp already has what I need.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Value Tracking should ignore optional parameters that aren't specified
3 participants