@@ -20,20 +20,20 @@ use core::iter;
20
20
use crate :: tokenizer:: Span ;
21
21
22
22
use 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 ,
37
37
} ;
38
38
39
39
/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -1262,6 +1262,9 @@ impl Spanned for Expr {
1262
1262
Expr :: Identifier ( ident) => ident. span ,
1263
1263
Expr :: CompoundIdentifier ( vec) => union_spans ( vec. iter ( ) . map ( |i| i. span ) ) ,
1264
1264
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
+ }
1265
1268
Expr :: IsFalse ( expr) => expr. span ( ) ,
1266
1269
Expr :: IsNotFalse ( expr) => expr. span ( ) ,
1267
1270
Expr :: IsTrue ( expr) => expr. span ( ) ,
@@ -1336,9 +1339,6 @@ impl Spanned for Expr {
1336
1339
Expr :: Nested ( expr) => expr. span ( ) ,
1337
1340
Expr :: Value ( value) => value. span ( ) ,
1338
1341
Expr :: TypedString { .. } => Span :: empty ( ) ,
1339
- Expr :: MapAccess { column, keys } => column
1340
- . span ( )
1341
- . union ( & union_spans ( keys. iter ( ) . map ( |i| i. key . span ( ) ) ) ) ,
1342
1342
Expr :: Function ( function) => function. span ( ) ,
1343
1343
Expr :: GroupingSets ( vec) => {
1344
1344
union_spans ( vec. iter ( ) . flat_map ( |i| i. iter ( ) . map ( |k| k. span ( ) ) ) )
@@ -1434,7 +1434,6 @@ impl Spanned for Expr {
1434
1434
Expr :: Named { .. } => Span :: empty ( ) ,
1435
1435
Expr :: Dictionary ( _) => Span :: empty ( ) ,
1436
1436
Expr :: Map ( _) => Span :: empty ( ) ,
1437
- Expr :: Subscript { expr, subscript } => expr. span ( ) . union ( & subscript. span ( ) ) ,
1438
1437
Expr :: Interval ( interval) => interval. value . span ( ) ,
1439
1438
Expr :: Wildcard ( token) => token. 0 . span ,
1440
1439
Expr :: QualifiedWildcard ( object_name, token) => union_spans (
@@ -1473,6 +1472,15 @@ impl Spanned for Subscript {
1473
1472
}
1474
1473
}
1475
1474
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
+
1476
1484
impl Spanned for ObjectName {
1477
1485
fn span ( & self ) -> Span {
1478
1486
let ObjectName ( segments) = self ;
0 commit comments