sway_core/language/parsed/
code_block.rs

1use crate::{
2    engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext},
3    language::parsed::AstNode,
4};
5
6use sway_types::{span::Span, Spanned};
7
8#[derive(Debug, Clone)]
9pub struct CodeBlock {
10    pub contents: Vec<AstNode>,
11    pub(crate) whole_block_span: Span,
12}
13
14impl EqWithEngines for CodeBlock {}
15impl PartialEqWithEngines for CodeBlock {
16    fn eq(&self, other: &Self, ctx: &PartialEqWithEnginesContext) -> bool {
17        self.contents.eq(&other.contents, ctx)
18    }
19}
20
21impl Spanned for CodeBlock {
22    fn span(&self) -> Span {
23        self.whole_block_span.clone()
24    }
25}