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

[ruby] Begin, Rescue, Ensure (Try-Catch Statements) #3927

Closed
DavidBakerEffendi opened this issue Dec 11, 2023 · 0 comments · Fixed by #3970 or #3976
Closed

[ruby] Begin, Rescue, Ensure (Try-Catch Statements) #3927

DavidBakerEffendi opened this issue Dec 11, 2023 · 0 comments · Fixed by #3970 or #3976
Assignees
Labels
ruby Relates to rubysrc2cpg

Comments

@DavidBakerEffendi
Copy link
Collaborator

A laymans example can be found here: https://stackoverflow.com/questions/2191632/begin-rescue-and-ensure-in-ruby

These are simply try-catch-finally statements, and there should be an attempt at that in the deprecated AstForControlStructuresCreator.

Java and C frontends may have better examples on this implementation. For these structures, the index of the blocks representing Begin, Rescue, and Ensure are important for CFG creation.

@DavidBakerEffendi DavidBakerEffendi added the ruby Relates to rubysrc2cpg label Dec 11, 2023
DavidBakerEffendi pushed a commit that referenced this issue Dec 21, 2023
#3927 (#3976)

* Add begin-rescue-else-ensure to intermediate ast

* Add basic begin-rescue-else-ensure-end

* Scalafmt

* Implicit return for RescueExpression and fallback

* Add an ignored test RescueExpression dataflow

* Expand on rescue querying test

* Scalafmt

* Address PR comment

* Separate tests to satisfy scalafmtCheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Relates to rubysrc2cpg
Projects
None yet
2 participants