diff options
Diffstat (limited to 'src/eval/scope.rs')
| -rw-r--r-- | src/eval/scope.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/eval/scope.rs b/src/eval/scope.rs index 8f2bd1d5..0991564f 100644 --- a/src/eval/scope.rs +++ b/src/eval/scope.rs @@ -21,9 +21,22 @@ pub struct Scopes<'a> { } impl<'a> Scopes<'a> { - /// Create a new hierarchy of scopes. - pub fn new(base: Option<&'a Scope>) -> Self { - Self { top: Scope::new(), scopes: vec![], base } + /// Create a new, empty hierarchy of scopes. + pub fn new() -> Self { + Self { + top: Scope::new(), + scopes: vec![], + base: None, + } + } + + /// Create a new hierarchy of scopes with a base scope. + pub fn with_base(base: &'a Scope) -> Self { + Self { + top: Scope::new(), + scopes: vec![], + base: Some(base), + } } /// Push a new scope. |
