diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-02-09 19:46:57 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-02-09 19:46:57 +0100 |
| commit | 06ca740d01b428f12f6bd327257cd05dce737b03 (patch) | |
| tree | 995bf8ff3a606aedecf296c9e805e11e9cd0ae8e /src/eval/scope.rs | |
| parent | e35bbfffcb1f84b2fb0679759152ca0a5eabfad4 (diff) | |
Split evaluation and execution 🔪
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. |
