@@ -28,7 +28,26 @@ use core::iter;
2828use crate :: tokenizer:: Span ;
2929
3030use super :: {
31- AccessExpr , AlterColumnOperation , AlterIndexOperation , AlterTableOperation , Analyze , Array , Assignment , AssignmentTarget , AttachedToken , BeginEndStatements , CaseExpr , CaseStatement , CastExpr , CloseCursor , ClusteredIndex , ColumnDef , ColumnOption , ColumnOptionDef , ConditionalStatementBlock , ConditionalStatements , ConflictTarget , ConnectByKind , ConstraintCharacteristics , ConvertExpr , CopySource , CreateIndex , CreateTable , CreateTableOptions , Cte , Delete , DoUpdate , ExceptSelectItem , ExcludeSelectItem , Expr , ExprWithAlias , Fetch , ForValues , FromTable , Function , FunctionArg , FunctionArgExpr , FunctionArgumentClause , FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound , IfStatement , IlikeSelectItem , IndexColumn , Insert , Interpolate , InterpolateExpr , Join , JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , LimitClause , MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause , MergeInsertExpr , MergeInsertKind , MergeUpdateExpr , NamedParenthesizedList , NamedWindowDefinition , ObjectName , ObjectNamePart , Offset , OnConflict , OnConflictAction , OnInsert , OpenStatement , OrderBy , OrderByExpr , OrderByKind , OutputClause , Partition , PartitionBoundValue , PivotValueSource , ProjectionSelect , Query , RaiseStatement , RaiseStatementValue , ReferentialAction , RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint , TableFactor , TableObject , TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use , Value , Values , ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With , WithFill , comments, dcl:: SecondaryRoles , value:: ValueWithSpan
31+ comments, dcl:: SecondaryRoles , value:: ValueWithSpan , AccessExpr , AlterColumnOperation ,
32+ AlterIndexOperation , AlterTableOperation , Analyze , Array , Assignment , AssignmentTarget ,
33+ AttachedToken , BeginEndStatements , CaseExpr , CaseStatement , CastExpr , CloseCursor ,
34+ ClusteredIndex , ColumnDef , ColumnOption , ColumnOptionDef , ConditionalStatementBlock ,
35+ ConditionalStatements , ConflictTarget , ConnectByKind , ConstraintCharacteristics , ConvertExpr ,
36+ CopySource , CreateIndex , CreateTable , CreateTableOptions , Cte , Delete , DoUpdate ,
37+ ExceptSelectItem , ExcludeSelectItem , Expr , ExprWithAlias , Fetch , ForValues , FromTable ,
38+ Function , FunctionArg , FunctionArgExpr , FunctionArgumentClause , FunctionArgumentList ,
39+ FunctionArguments , GroupByExpr , HavingBound , IfStatement , IlikeSelectItem , IndexColumn , Insert ,
40+ Interpolate , InterpolateExpr , Join , JoinConstraint , JoinOperator , JsonPath , JsonPathElem ,
41+ LateralView , LimitClause , MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause ,
42+ MergeInsertExpr , MergeInsertKind , MergeUpdateExpr , NamedParenthesizedList ,
43+ NamedWindowDefinition , ObjectName , ObjectNamePart , Offset , OnConflict , OnConflictAction ,
44+ OnInsert , OpenStatement , OrderBy , OrderByExpr , OrderByKind , OutputClause , Partition ,
45+ PartitionBoundValue , PivotValueSource , ProjectionSelect , Query , RaiseStatement ,
46+ RaiseStatementValue , ReferentialAction , RenameSelectItem , ReplaceSelectElement ,
47+ ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , SqlOption , Statement , Subscript ,
48+ SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint , TableFactor , TableObject ,
49+ TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use , Value , Values ,
50+ ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With , WithFill ,
3251} ;
3352
3453/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -1547,11 +1566,11 @@ impl Spanned for Expr {
15471566 is_try : _,
15481567 } = & * * convert;
15491568 union_spans (
1550- core:: iter:: once ( expr. span ( ) )
1551- . chain ( charset. as_ref ( ) . map ( |i| i. span ( ) ) )
1552- . chain ( styles. iter ( ) . map ( |i| i. span ( ) ) ) ,
1569+ core:: iter:: once ( expr. span ( ) )
1570+ . chain ( charset. as_ref ( ) . map ( |i| i. span ( ) ) )
1571+ . chain ( styles. iter ( ) . map ( |i| i. span ( ) ) ) ,
15531572 )
1554- } ,
1573+ }
15551574 Expr :: Cast ( cast) => {
15561575 let CastExpr {
15571576 kind : _,
@@ -1606,19 +1625,20 @@ impl Spanned for Expr {
16061625 else_result,
16071626 } = & * * case;
16081627 union_spans (
1609- iter:: once ( case_token. 0 . span )
1610- . chain (
1611- operand
1612- . as_ref ( )
1613- . map ( |i| i. span ( ) )
1614- . into_iter ( )
1615- . chain ( conditions. iter ( ) . flat_map ( |case_when| {
1616- [ case_when. condition . span ( ) , case_when. result . span ( ) ]
1617- } ) )
1618- . chain ( else_result. as_ref ( ) . map ( |i| i. span ( ) ) ) ,
1619- )
1620- . chain ( iter:: once ( end_token. 0 . span ) ) ,
1621- ) } ,
1628+ iter:: once ( case_token. 0 . span )
1629+ . chain (
1630+ operand
1631+ . as_ref ( )
1632+ . map ( |i| i. span ( ) )
1633+ . into_iter ( )
1634+ . chain ( conditions. iter ( ) . flat_map ( |case_when| {
1635+ [ case_when. condition . span ( ) , case_when. result . span ( ) ]
1636+ } ) )
1637+ . chain ( else_result. as_ref ( ) . map ( |i| i. span ( ) ) ) ,
1638+ )
1639+ . chain ( iter:: once ( end_token. 0 . span ) ) ,
1640+ )
1641+ }
16221642 Expr :: Exists { subquery, .. } => subquery. span ( ) ,
16231643 Expr :: Subquery ( query) => query. span ( ) ,
16241644 Expr :: Struct { .. } => Span :: empty ( ) ,
0 commit comments