@@ -41,13 +41,13 @@ use super::{
4141 MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause , MergeInsertExpr ,
4242 MergeInsertKind , MergeUpdateExpr , NamedParenthesizedList , NamedWindowDefinition , ObjectName ,
4343 ObjectNamePart , Offset , OnConflict , OnConflictAction , OnInsert , OpenStatement , OrderBy ,
44- OrderByExpr , OrderByKind , OutputClause , Partition , PartitionBoundValue , PivotValueSource ,
45- ProjectionSelect , Query , RaiseStatement , RaiseStatementValue , ReferentialAction ,
46- RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem ,
47- SetExpr , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef ,
48- TableConstraint , TableFactor , TableObject , TableOptionsClustered , TableWithJoins , Update ,
49- UpdateTableFromKind , Use , Values , ViewColumnDef , WhileStatement , WildcardAdditionalOptions ,
50- With , WithFill ,
44+ OrderByExpr , OrderByKind , OutputClause , Parens , Partition , PartitionBoundValue ,
45+ PivotValueSource , ProjectionSelect , Query , RaiseStatement , RaiseStatementValue ,
46+ ReferentialAction , RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select ,
47+ SelectInto , SelectItem , SetExpr , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias ,
48+ TableAliasColumnDef , TableConstraint , TableFactor , TableObject , TableOptionsClustered ,
49+ TableWithJoins , Update , UpdateTableFromKind , Use , Values , ViewColumnDef , WhileStatement ,
50+ WildcardAdditionalOptions , With , WithFill ,
5151} ;
5252
5353/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -106,6 +106,12 @@ impl Spanned for TokenWithSpan {
106106 }
107107}
108108
109+ impl < T > Spanned for Parens < T > {
110+ fn span ( & self ) -> Span {
111+ self . opening_token . 0 . span . union ( & self . closing_token . 0 . span )
112+ }
113+ }
114+
109115impl Spanned for Query {
110116 fn span ( & self ) -> Span {
111117 let Query {
@@ -239,10 +245,11 @@ impl Spanned for Values {
239245 rows,
240246 } = self ;
241247
242- union_spans (
243- rows. iter ( )
244- . map ( |row| union_spans ( row. iter ( ) . map ( |expr| expr. span ( ) ) ) ) ,
245- )
248+ match & rows[ ..] {
249+ [ ] => Span :: empty ( ) ,
250+ [ f] => f. span ( ) ,
251+ [ f, .., l] => f. span ( ) . union ( & l. span ( ) ) ,
252+ }
246253 }
247254}
248255
0 commit comments