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

feature: Support for ReturnStmt statement #180

Merged
merged 2 commits into from
Nov 6, 2024
Merged

Conversation

shivasurya
Copy link
Owner

Description:

This pull request introduces support for parsing and handling return statements within the sourcecode-parser module. The main changes involve adding a new ReturnStmt type, updating the graph construction logic to recognize return statements, and extending the test cases to cover this new functionality.

Parsing and Handling Return Statements:

  • Added ReturnStmt to the Node struct in construct.go to support return statements in the graph.
  • Implemented parsing logic for return statements in ParseReturnStatement function in parse_statement.go.
  • Updated the buildGraphFromAST function to handle return statements by creating ReturnStmt nodes.
  • Added GetReturnStmt method in query.go to retrieve return statements from the environment.

Updates to Test Cases:

  • Modified the TestBuildGraphFromAST function to include return statements in the expected node types and counts. [1] [2] [3]
  • Added test cases for the ReturnStmt type in stmt_test.go to verify the GetPP method with various expressions.

Codebase Enhancements:

  • Updated generateProxyEnv in query.go to include ReturnStmt in the proxy environment. [1] [2] [3]
  • Defined the ReturnStmt struct and its methods in stmt.go to represent return statements and their properties.

Checklist:

  • Tests passing (gradle testGo)?
  • Lint passing (golangci-lint run this requires golangci-lint)?

@shivasurya shivasurya added the enhancement New feature or request label Nov 6, 2024
@shivasurya shivasurya self-assigned this Nov 6, 2024
@shivasurya shivasurya enabled auto-merge (squash) November 6, 2024 21:46
@shivasurya shivasurya merged commit 660aed4 into main Nov 6, 2024
2 checks passed
@shivasurya shivasurya deleted the shiva/returnstmt-support branch November 6, 2024 21:46
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 53.65854% with 19 lines in your changes missing coverage. Please review.

Project coverage is 72.61%. Comparing base (db8d91e) to head (836e760).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sourcecode-parser/model/stmt.go 18.18% 9 Missing ⚠️
sourcecode-parser/graph/java/parse_statement.go 0.00% 6 Missing ⚠️
sourcecode-parser/graph/query.go 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
- Coverage   72.94%   72.61%   -0.33%     
==========================================
  Files          16       16              
  Lines        2358     2399      +41     
==========================================
+ Hits         1720     1742      +22     
- Misses        597      616      +19     
  Partials       41       41              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant