Skip to content

Conversation

@shivasurya
Copy link
Owner

@shivasurya shivasurya commented Nov 6, 2024

Description:

This pull request introduces support for parsing and handling assert statements in the codebase. The changes include updates to various parts of the code to recognize, parse, and test assert statements, similar to how yield statements are handled.

Enhancements to Statement Parsing:

  • Added AssertStmt to the Node struct to support assert statements. (sourcecode-parser/graph/construct.go)
  • Implemented parsing logic for assert statements in the buildGraphFromAST function. (sourcecode-parser/graph/construct.go)
  • Created ParseAssertStatement function to parse assert statements. (sourcecode-parser/graph/java/parse_statement.go)

Testing:

  • Added unit tests for ParseAssertStatement to ensure correct parsing of various assert statement formats. (sourcecode-parser/graph/java/parse_statement_test.go)
  • Added tests for GetMessage method of AssertStmt to validate message extraction logic. (sourcecode-parser/model/stmt_test.go)

Model Updates:

  • Defined the AssertStmt struct and its methods, including GetAPrimaryQlClass, GetHalsteadID, GetPP, ToString, GetMessage, and GetExpr. (sourcecode-parser/model/stmt.go)

Query Enhancements:

  • Added GetAssertStmt method to the Env struct to retrieve assert statements. (sourcecode-parser/graph/query.go)
  • Updated generateProxyEnv to include assert statements in the query environment. (sourcecode-parser/graph/query.go) [1] [2] [3]

Example Usage:

  • Added an example assert statement in the onOptionsItemSelected method. (test-src/android/app/src/main/java/com/ivb/udacity/movieDetailActivity.java)

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 merged commit db8d91e into main Nov 6, 2024
2 checks passed
@shivasurya shivasurya deleted the shiva/assert-stmt branch November 6, 2024 16:43
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.

2 participants