[apex] Summit-AST Apex module - Part 2 - expression nodes#4151
Merged
adangel merged 22 commits intoOct 20, 2022
Merged
Conversation
- Remove Jorje dependencies - Add temporary local jar dependency for Summit-AST - Comment out code until compilation succeeds
- Replace `ApexNode` type arguments with `Void` - Remove `ApexNode.getNode` - Remove `ASTCommentContainer` type parameter - Deprecate `ASTUserClassOrInterface` type parameter
Remove `node` field from `AbstractApexNode` to remove restriction of wrapping a single node. Create `AbstractApexNode.Single` subclass that wraps a single node. Other subclasses can be created as needed for common cases, or `AbstractApexNode` can be extended directly in irregular cases.
- Add call to `SummitAST` in `ApexParser` - Fix NPE involving `suppressMap` to allow `ApexTreeBuilder` to run - Remove unused `TopLevelVisitor`
Replace `CompilationUnit` with `TypeDeclaration` as the top-level node to match the AST produced by Jorje.
- Replace `ApexTreeBuilder.java` with `ApexTreeBuilder.kt` - Set up tree builder foundation - Build `TypeDeclaration` nodes
- Add `AbstractApexNode.Many`
- Add `buildChildren` function to tree builder
- Split `setParent` call from main `build` function into new `buildAndSetParent` - Remove list-based `build` function to decrease complexity - Improve documentation
* Build expression statements ** Build assignment expressions ** Build array expressions ** Build literal expressions ** Build cast expressions ** Build operator expressions ** Build `this`/`super` expressions ** Build type reference expressions ** Build field/variable expressions ** Build method call expressions * Build ternary expressions * Refactor `AbstractApexNode` ** Add default implementations for some methods ** Add empty constructor ** Implement `AbstractApexNode.getDefiningType` * Fix `ASTLiteralExpression.getImage` * Implement reference types ** Implement `ASTReferenceExpression.isSObjectType` ** Implement `ASTReferenceExpression.hasRealLoc` ** Fix `ASTEmptyReferenceExpression.getDefiningType` * Implement `ASTMethodCallExpression.getFullMethodName` * Update `ASTLiteralExpression.getImage` * Replace `Triple` with `data class` * Fix `BITWISE_XOR` * Replace `Identifier.asCodeString` with `getString` * Fix call expressions ** Only the `receiver` of `CallExpression`s should be flattened * Fix `referenceTypeOf` Reference type should only be `STORE` when the variable is the target of assignment. * Rename `ASTMethodCallExpression.components`
…arser Change-Id: If0e9011847b2fa515faaacc631c0876ac0683d2a
Update summit-ast dependency to latest release. Change-Id: I14cb01fe198c6fc78dcd90b1f23c44e42c573bba
Contributor
Author
|
(Test failures in this experimental branch continue to be expected until the AST is fully translated.) |
16 tasks
adangel
approved these changes
Oct 16, 2022
* Removed Kotlin compiler version in submodule pom.xml * Package-private AST node constructors * Constructor method naming for getImage and getCanonicalName Change-Id: I4b2cd2ca0437c480e5fc52cf3147be7a2336f6f7
Change-Id: I715bc3729d7c631993cfcfb6c6f503b959ce4340
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second part of Summit-AST-based Apex module.
Changes
Build expression nodes
this/superexpressionsRefactor
AbstractApexNodeAbstractApexNode.getDefiningTypeImplement reference types
ASTReferenceExpression.isSObjectTypeASTReferenceExpression.hasRealLocASTEmptyReferenceExpression.getDefiningTypeMiscellaneous
ASTMethodCallExpression.getFullMethodNameASTLiteralExpression.getImageTriplewithdata classBITWISE_XORIdentifier.asCodeStringwithgetStringASTLiteralExpression.getImageRelated issues: