Moved more structs outside of Statement to facilitate reuse #2188
+355
−269
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.
This PR refactors several
Statementenum variants into their own dedicated structs. This follows the pattern of recent refactors to improve the modularity and type safety of the AST.Specifically, the following statements have been extracted:
CreatePolicyDropPolicyAlterPolicyGrantRevokeI implemented
From<Struct> for Statementandfmt::Displayfor each new struct.As done in PR #2160 and for the same reasons, I have updated parser methods to return the specific struct type instead of the generic
Statementenum:-
parse_create_policy() -> Result<CreatePolicy, ...>-
parse_drop_policy() -> Result<DropPolicy, ...>-
parse_alter_policy() -> Result<AlterPolicy, ...>-
parse_grant() -> Result<Grant, ...>-
parse_revoke() -> Result<Revoke, ...>This PR does not yet cover all Statement struct variants that likely should be converted into tuple variants, we'll get there in time.
Luca