From 14aa7c242a9055a6a1e6e7116ca40550c87a166e Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 2 Sep 2024 03:51:19 -0400 Subject: [PATCH] Ignore context in Debug format for AST --- dust-lang/src/ast/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dust-lang/src/ast/mod.rs b/dust-lang/src/ast/mod.rs index 4aab44e..3906081 100644 --- a/dust-lang/src/ast/mod.rs +++ b/dust-lang/src/ast/mod.rs @@ -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, @@ -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 {