-
Notifications
You must be signed in to change notification settings - Fork 606
Rename ASTNode to Expr #119
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
Conversation
Pull Request Test Coverage Report for Build 365
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for doing this!
src/sqlast/query.rs
Outdated
@@ -177,9 +177,9 @@ impl ToString for Cte { | |||
#[derive(Debug, Clone, PartialEq, Hash)] | |||
pub enum SQLSelectItem { | |||
/// Any expression, not followed by `[ AS ] alias` | |||
UnnamedExpression(ASTNode), | |||
UnnamedExpression(Expr), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep UnnamedExpression
and ExpressionWithAlias
or rename them to use Expr
? Same for parse_.._expression() methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good idea! Done.
src/sqlast/mod.rs
Outdated
}, | ||
/// Unary operation e.g. `NOT foo` | ||
SQLUnaryOp { | ||
op: SQLUnaryOperator, | ||
expr: Box<ASTNode>, | ||
expr: Box<Expr>, | ||
}, | ||
/// CAST an expression to a different data type e.g. `CAST(foo AS VARCHAR(123))` | ||
SQLCast { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My version of cargo fmt
reformats this (and a few others) on one line. I wonder why CI doesn't catch it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version of the Rust toolchain are you using? Perhaps the formatting here is different in different versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind. I think something's broken in CI.
The ASTNode enum was confusingly named. In the past, the name made sense, as the enum contained nearly all of the nodes in the AST, but over time, pieces have been split into different structs, like SQLStatement and SQLQuery. The ASTNode enum now contains only contains expression nodes, so Expr is a better name. Also rename the UnnamedExpression and ExpressionWithAlias variants of SQLSelectItem to UnnamedExpr and ExprWithAlias, respectively, to match the new shorthand for the word "expression".
This looks ready to merge to me! |
The ASTNode enum was confusingly named. In the past, the name made
sense, as the enum contained nearly all of the nodes in the AST, but
over time, pieces have been split into different structs, like
SQLStatement and SQLQuery. The ASTNode enum now contains only contains
expression nodes, so Expr is a better name.
Extracted from #105.