From dfe86c09ccd357f8fc6be4598a0f3059bcc53ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 31 Jan 2020 13:53:42 +0100 Subject: [PATCH] Add convenience constructor --- src/ast.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ast.rs b/src/ast.rs index 5c5093b..601ab18 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -62,6 +62,15 @@ pub struct VariableDeclarationStack impl VariableDeclarationStack { + pub fn new() -> Self + { + Self + { + free_variable_declarations: VariableDeclarations::new(), + bound_variable_declaration_stack: vec![], + } + } + pub fn find(&self, variable_name: &str) -> Option> { for variable_declarations in self.bound_variable_declaration_stack.iter().rev()