Skip to content

Commit 807468f

Browse files
committed
Implement Spanned trait for BeginEndStatements
1 parent 6a06362 commit 807468f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/ast/spans.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use crate::tokenizer::Span;
2323
use super::{
2424
dcl::SecondaryRoles, value::ValueWithSpan, AccessExpr, AlterColumnOperation,
2525
AlterIndexOperation, AlterTableOperation, Array, Assignment, AssignmentTarget, AttachedToken,
26-
CaseStatement, CloseCursor, ClusteredIndex, ColumnDef, ColumnOption, ColumnOptionDef,
27-
ConditionalStatementBlock, ConditionalStatements, ConflictTarget, ConnectBy,
26+
BeginEndStatements, CaseStatement, CloseCursor, ClusteredIndex, ColumnDef, ColumnOption,
27+
ColumnOptionDef, ConditionalStatementBlock, ConditionalStatements, ConflictTarget, ConnectBy,
2828
ConstraintCharacteristics, CopySource, CreateIndex, CreateTable, CreateTableOptions, Cte,
2929
Delete, DoUpdate, ExceptSelectItem, ExcludeSelectItem, Expr, ExprWithAlias, Fetch, FromTable,
3030
Function, FunctionArg, FunctionArgExpr, FunctionArgumentClause, FunctionArgumentList,
@@ -779,9 +779,7 @@ impl Spanned for ConditionalStatements {
779779
ConditionalStatements::Sequence { statements } => {
780780
union_spans(statements.iter().map(|s| s.span()))
781781
}
782-
ConditionalStatements::BeginEnd(bes) => {
783-
union_spans([bes.begin_token.0.span, bes.end_token.0.span].into_iter())
784-
}
782+
ConditionalStatements::BeginEnd(bes) => bes.span(),
785783
}
786784
}
787785
}
@@ -2280,6 +2278,12 @@ impl Spanned for TableObject {
22802278
}
22812279
}
22822280

2281+
impl Spanned for BeginEndStatements {
2282+
fn span(&self) -> Span {
2283+
union_spans([self.begin_token.0.span, self.end_token.0.span].into_iter())
2284+
}
2285+
}
2286+
22832287
#[cfg(test)]
22842288
pub mod tests {
22852289
use crate::dialect::{Dialect, GenericDialect, SnowflakeDialect};

0 commit comments

Comments
 (0)