Skip to content

Commit 7782556

Browse files
Restored previous implementation of Spanned trait for CreateView
1 parent 20d1c9d commit 7782556

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

src/ast/ddl.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,30 +3641,6 @@ impl fmt::Display for CreateView {
36413641
}
36423642
}
36433643

3644-
impl Spanned for CreateView {
3645-
fn span(&self) -> Span {
3646-
let name_span = self.name.span();
3647-
let query_span = self.query.span();
3648-
let options_span = self.options.span();
3649-
3650-
// Union all the relevant spans
3651-
let mut spans = vec![name_span, query_span, options_span];
3652-
3653-
// Add column spans
3654-
spans.extend(self.columns.iter().map(|col| col.span()));
3655-
3656-
// Add cluster_by spans
3657-
spans.extend(self.cluster_by.iter().map(|ident| ident.span));
3658-
3659-
// Add to span if present
3660-
if let Some(ref to) = self.to {
3661-
spans.push(to.span());
3662-
}
3663-
3664-
Span::union_iter(spans)
3665-
}
3666-
}
3667-
36683644
/// CREATE EXTENSION statement
36693645
/// Note: this is a PostgreSQL-specific statement
36703646
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]

src/ast/spans.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use crate::ast::{
1919
ddl::AlterSchema, query::SelectItemQualifiedWildcardKind, AlterSchemaOperation, AlterTable,
20-
ColumnOptions, ExportData, Owner, TypedString,
20+
ColumnOptions, CreateView, ExportData, Owner, TypedString,
2121
};
2222
use core::iter;
2323

@@ -2402,6 +2402,19 @@ impl Spanned for AlterSchema {
24022402
}
24032403
}
24042404

2405+
impl Spanned for CreateView {
2406+
fn span(&self) -> Span {
2407+
union_spans(
2408+
core::iter::once(self.name.span())
2409+
.chain(self.columns.iter().map(|i| i.span()))
2410+
.chain(core::iter::once(self.query.span()))
2411+
.chain(core::iter::once(self.options.span()))
2412+
.chain(self.cluster_by.iter().map(|i| i.span))
2413+
.chain(self.to.iter().map(|i| i.span())),
2414+
)
2415+
}
2416+
}
2417+
24052418
impl Spanned for AlterTable {
24062419
fn span(&self) -> Span {
24072420
union_spans(

0 commit comments

Comments
 (0)