Correct typo: indexs to indexes (#492)

This commit is contained in:
Andrew Lamb 2022-05-22 15:03:48 -04:00 committed by GitHub
parent dd805e9a6b
commit 11046f66e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -371,7 +371,7 @@ pub enum Expr {
/// An array index expression e.g. `(ARRAY[1, 2])[1]` or `(current_schemas(FALSE))[1]` /// An array index expression e.g. `(ARRAY[1, 2])[1]` or `(current_schemas(FALSE))[1]`
ArrayIndex { ArrayIndex {
obj: Box<Expr>, obj: Box<Expr>,
indexs: Vec<Expr>, indexes: Vec<Expr>,
}, },
/// An array expression e.g. `ARRAY[1, 2]` /// An array expression e.g. `ARRAY[1, 2]`
Array(Array), Array(Array),
@ -553,9 +553,9 @@ impl fmt::Display for Expr {
Expr::Tuple(exprs) => { Expr::Tuple(exprs) => {
write!(f, "({})", display_comma_separated(exprs)) write!(f, "({})", display_comma_separated(exprs))
} }
Expr::ArrayIndex { obj, indexs } => { Expr::ArrayIndex { obj, indexes } => {
write!(f, "{}", obj)?; write!(f, "{}", obj)?;
for i in indexs { for i in indexes {
write!(f, "[{}]", i)?; write!(f, "[{}]", i)?;
} }
Ok(()) Ok(())

View file

@ -1234,15 +1234,15 @@ impl<'a> Parser<'a> {
pub fn parse_array_index(&mut self, expr: Expr) -> Result<Expr, ParserError> { pub fn parse_array_index(&mut self, expr: Expr) -> Result<Expr, ParserError> {
let index = self.parse_expr()?; let index = self.parse_expr()?;
self.expect_token(&Token::RBracket)?; self.expect_token(&Token::RBracket)?;
let mut indexs: Vec<Expr> = vec![index]; let mut indexes: Vec<Expr> = vec![index];
while self.consume_token(&Token::LBracket) { while self.consume_token(&Token::LBracket) {
let index = self.parse_expr()?; let index = self.parse_expr()?;
self.expect_token(&Token::RBracket)?; self.expect_token(&Token::RBracket)?;
indexs.push(index); indexes.push(index);
} }
Ok(Expr::ArrayIndex { Ok(Expr::ArrayIndex {
obj: Box::new(expr), obj: Box::new(expr),
indexs, indexes,
}) })
} }

View file

@ -1173,7 +1173,7 @@ fn parse_array_index_expr() {
assert_eq!( assert_eq!(
&Expr::ArrayIndex { &Expr::ArrayIndex {
obj: Box::new(Expr::Identifier(Ident::new("foo"))), obj: Box::new(Expr::Identifier(Ident::new("foo"))),
indexs: vec![num[0].clone()], indexes: vec![num[0].clone()],
}, },
expr_from_projection(only(&select.projection)), expr_from_projection(only(&select.projection)),
); );
@ -1183,7 +1183,7 @@ fn parse_array_index_expr() {
assert_eq!( assert_eq!(
&Expr::ArrayIndex { &Expr::ArrayIndex {
obj: Box::new(Expr::Identifier(Ident::new("foo"))), obj: Box::new(Expr::Identifier(Ident::new("foo"))),
indexs: vec![num[0].clone(), num[0].clone()], indexes: vec![num[0].clone(), num[0].clone()],
}, },
expr_from_projection(only(&select.projection)), expr_from_projection(only(&select.projection)),
); );
@ -1193,7 +1193,7 @@ fn parse_array_index_expr() {
assert_eq!( assert_eq!(
&Expr::ArrayIndex { &Expr::ArrayIndex {
obj: Box::new(Expr::Identifier(Ident::new("bar"))), obj: Box::new(Expr::Identifier(Ident::new("bar"))),
indexs: vec![ indexes: vec![
num[0].clone(), num[0].clone(),
Expr::Identifier(Ident { Expr::Identifier(Ident {
value: "baz".to_string(), value: "baz".to_string(),
@ -1224,7 +1224,7 @@ fn parse_array_index_expr() {
None None
))))) )))))
}))), }))),
indexs: vec![num[1].clone(), num[2].clone()], indexes: vec![num[1].clone(), num[2].clone()],
}, },
expr_from_projection(only(&select.projection)), expr_from_projection(only(&select.projection)),
); );