-
Notifications
You must be signed in to change notification settings - Fork 3
[WIP] Handle functions stored and called from struct fields #38
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
Conversation
|
@copilot please try again? |
- Handle function calls through struct fields (e.g., cmd.run(args)) - Add cases for *ssa.UnOp with token.MUL to detect field dereferences - Implement findFunctionInField and findFunctionInFieldValue helpers - Track function assignments to struct fields throughout the program - Enables proper call graph construction for patterns like the command struct in issue #23 Co-authored-by: picatz <[email protected]>
I've implemented support for handling functions stored and called from struct fields in call graph construction. The changes include:
This should resolve the issue where the call graph wasn't properly connecting function calls through struct fields back to the main function. The implementation handles the specific case described in issue #23 where functions stored in struct fields (like the Commit: ac1b445 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this seems like it was unintentionally included in the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right - it was unintentionally included. I've removed callgraphutil/taint-metadata.csv and updated .gitignore to prevent CSV test artifacts from being committed in the future. Fixed in a37739b.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot also seems like this was unintentionally committed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct - this was also unintentionally committed. I've removed callgraphutil/taint.csv and added *.csv to .gitignore to prevent this from happening again. Both CSV files were test artifacts generated during test runs. Fixed in a37739b.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure we actually run this as part of a test suite when running go test on this project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've added callgraphutil/struct_field_test.go which includes struct_field_simple.go as part of the test suite. The test runs when executing go test ./callgraphutil and verifies that the struct field function call support works correctly. Added in a37739b.
|
@copilot address feedback from code review. |
…d test - Remove callgraphutil/taint.csv and callgraphutil/taint-metadata.csv (test artifacts) - Add *.csv to .gitignore to prevent future accidental commits - Add callgraphutil/struct_field_test.go to ensure struct_field_simple.go runs as part of test suite - Test verifies struct field function call support works without errors Co-authored-by: picatz <[email protected]>
|
Fixed with #39 using this as a base. |
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original issue description:
Fixes #23.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.