Ignore context in Debug format for AST

This commit is contained in:
Jeff 2024-09-02 03:51:19 -04:00
parent e643ebe114
commit 14aa7c242a

View File

@ -7,7 +7,7 @@ pub use statement::*;
use std::{
collections::VecDeque,
fmt::{self, Display, Formatter},
fmt::{self, Debug, Display, Formatter},
num::TryFromIntError,
};
@ -18,7 +18,7 @@ use crate::{Context, ContextError};
pub type Span = (usize, usize);
/// In-memory representation of a Dust program.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Clone, Serialize, Deserialize)]
pub struct AbstractSyntaxTree {
pub statements: VecDeque<Statement>,
@ -26,6 +26,14 @@ pub struct AbstractSyntaxTree {
pub context: Context,
}
impl Debug for AbstractSyntaxTree {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.debug_struct("AbstractSyntaxTree")
.field("statements", &self.statements)
.finish()
}
}
impl Eq for AbstractSyntaxTree {}
impl PartialEq for AbstractSyntaxTree {