diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-28 21:01:05 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-28 21:01:36 +0100 |
| commit | 9c906f92c50d453822b12896d29b7883802ea567 (patch) | |
| tree | 78e2465a4fa805bbddc80407b7eea585b5ebb60c /src/eval | |
| parent | 3a07603b66fab6b343b34156f4a3a6015e2d69e1 (diff) | |
Parse `break`, `continue` and `return` expression
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 2023004f..a8c6c688 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -390,6 +390,9 @@ impl Eval for Expr { Self::For(v) => v.eval(ctx), Self::Import(v) => v.eval(ctx), Self::Include(v) => v.eval(ctx), + Self::Break(v) => v.eval(ctx), + Self::Continue(v) => v.eval(ctx), + Self::Return(v) => v.eval(ctx), } } } @@ -905,6 +908,30 @@ impl Eval for IncludeExpr { } } +impl Eval for BreakExpr { + type Output = Value; + + fn eval(&self, _: &mut EvalContext) -> TypResult<Self::Output> { + Err("break is not yet implemented").at(self.span()) + } +} + +impl Eval for ContinueExpr { + type Output = Value; + + fn eval(&self, _: &mut EvalContext) -> TypResult<Self::Output> { + Err("continue is not yet implemented").at(self.span()) + } +} + +impl Eval for ReturnExpr { + type Output = Value; + + fn eval(&self, _: &mut EvalContext) -> TypResult<Self::Output> { + Err("return is not yet implemented").at(self.span()) + } +} + /// Try to mutably access the value an expression points to. /// /// This only works if the expression is a valid lvalue. |
