From 279c9d613568a40ffe0d31c5945ca7af4427a0c3 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Thu, 16 Nov 2023 17:35:59 -0700 Subject: [PATCH] Ast: add push method to blocks --- src/ast.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ast.rs b/src/ast.rs index de220e6..bac3b71 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -46,6 +46,12 @@ pub struct GlobalBlock { statements: Vec>, } +impl GlobalBlock { + pub fn push_node(&mut self, node: Box) { + self.statements.push(node); + } +} + impl ToString for GlobalBlock { fn to_string(&self) -> String { let mut s = String::new(); @@ -64,6 +70,12 @@ pub struct Block { statements: Vec>, } +impl Block { + pub fn push_node(&mut self, node: Box) { + self.statements.push(node); + } +} + impl ToString for Block { fn to_string(&self) -> String { let mut s = String::from("{ ");