@@ -20,20 +20,20 @@ use core::iter;
2020use crate :: tokenizer:: Span ;
2121
2222use super :: {
23- dcl:: SecondaryRoles , AlterColumnOperation , AlterIndexOperation , AlterTableOperation , Array ,
24- Assignment , AssignmentTarget , CloseCursor , ClusteredIndex , ColumnDef , ColumnOption ,
25- ColumnOptionDef , ConflictTarget , ConnectBy , ConstraintCharacteristics , CopySource , CreateIndex ,
26- CreateTable , CreateTableOptions , Cte , Delete , DoUpdate , ExceptSelectItem , ExcludeSelectItem ,
27- Expr , ExprWithAlias , Fetch , FromTable , Function , FunctionArg , FunctionArgExpr ,
28- FunctionArgumentClause , FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound ,
29- IlikeSelectItem , Insert , Interpolate , InterpolateExpr , Join , JoinConstraint , JoinOperator ,
30- JsonPath , JsonPathElem , LateralView , MatchRecognizePattern , Measure , NamedWindowDefinition ,
31- ObjectName , Offset , OnConflict , OnConflictAction , OnInsert , OrderBy , OrderByExpr , Partition ,
32- PivotValueSource , ProjectionSelect , Query , ReferentialAction , RenameSelectItem ,
33- ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , SqlOption ,
34- Statement , Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint ,
35- TableFactor , TableOptionsClustered , TableWithJoins , Use , Value , Values , ViewColumnDef ,
36- WildcardAdditionalOptions , With , WithFill ,
23+ dcl:: SecondaryRoles , AccessExpr , AlterColumnOperation , AlterIndexOperation ,
24+ AlterTableOperation , Array , Assignment , AssignmentTarget , CloseCursor , ClusteredIndex ,
25+ ColumnDef , ColumnOption , ColumnOptionDef , ConflictTarget , ConnectBy , ConstraintCharacteristics ,
26+ CopySource , CreateIndex , CreateTable , CreateTableOptions , Cte , Delete , DoUpdate ,
27+ ExceptSelectItem , ExcludeSelectItem , Expr , ExprWithAlias , Fetch , FromTable , Function ,
28+ FunctionArg , FunctionArgExpr , FunctionArgumentClause , FunctionArgumentList , FunctionArguments ,
29+ GroupByExpr , HavingBound , IlikeSelectItem , Insert , Interpolate , InterpolateExpr , Join ,
30+ JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , MatchRecognizePattern ,
31+ Measure , NamedWindowDefinition , ObjectName , Offset , OnConflict , OnConflictAction , OnInsert ,
32+ OrderBy , OrderByExpr , Partition , PivotValueSource , ProjectionSelect , Query , ReferentialAction ,
33+ RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem ,
34+ SetExpr , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef ,
35+ TableConstraint , TableFactor , TableOptionsClustered , TableWithJoins , Use , Value , Values ,
36+ ViewColumnDef , WildcardAdditionalOptions , With , WithFill ,
3737} ;
3838
3939/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -1262,6 +1262,9 @@ impl Spanned for Expr {
12621262 Expr :: Identifier ( ident) => ident. span ,
12631263 Expr :: CompoundIdentifier ( vec) => union_spans ( vec. iter ( ) . map ( |i| i. span ) ) ,
12641264 Expr :: CompositeAccess { expr, key } => expr. span ( ) . union ( & key. span ) ,
1265+ Expr :: CompoundFieldAccess { root, access_chain } => {
1266+ union_spans ( iter:: once ( root. span ( ) ) . chain ( access_chain. iter ( ) . map ( |i| i. span ( ) ) ) )
1267+ }
12651268 Expr :: IsFalse ( expr) => expr. span ( ) ,
12661269 Expr :: IsNotFalse ( expr) => expr. span ( ) ,
12671270 Expr :: IsTrue ( expr) => expr. span ( ) ,
@@ -1336,9 +1339,6 @@ impl Spanned for Expr {
13361339 Expr :: Nested ( expr) => expr. span ( ) ,
13371340 Expr :: Value ( value) => value. span ( ) ,
13381341 Expr :: TypedString { .. } => Span :: empty ( ) ,
1339- Expr :: MapAccess { column, keys } => column
1340- . span ( )
1341- . union ( & union_spans ( keys. iter ( ) . map ( |i| i. key . span ( ) ) ) ) ,
13421342 Expr :: Function ( function) => function. span ( ) ,
13431343 Expr :: GroupingSets ( vec) => {
13441344 union_spans ( vec. iter ( ) . flat_map ( |i| i. iter ( ) . map ( |k| k. span ( ) ) ) )
@@ -1434,7 +1434,6 @@ impl Spanned for Expr {
14341434 Expr :: Named { .. } => Span :: empty ( ) ,
14351435 Expr :: Dictionary ( _) => Span :: empty ( ) ,
14361436 Expr :: Map ( _) => Span :: empty ( ) ,
1437- Expr :: Subscript { expr, subscript } => expr. span ( ) . union ( & subscript. span ( ) ) ,
14381437 Expr :: Interval ( interval) => interval. value . span ( ) ,
14391438 Expr :: Wildcard ( token) => token. 0 . span ,
14401439 Expr :: QualifiedWildcard ( object_name, token) => union_spans (
@@ -1473,6 +1472,15 @@ impl Spanned for Subscript {
14731472 }
14741473}
14751474
1475+ impl Spanned for AccessExpr {
1476+ fn span ( & self ) -> Span {
1477+ match self {
1478+ AccessExpr :: Dot ( ident) => ident. span ( ) ,
1479+ AccessExpr :: Subscript ( subscript) => subscript. span ( ) ,
1480+ }
1481+ }
1482+ }
1483+
14761484impl Spanned for ObjectName {
14771485 fn span ( & self ) -> Span {
14781486 let ObjectName ( segments) = self ;
0 commit comments