summaryrefslogtreecommitdiff
path: root/src/eval/value.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-03 17:56:56 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-03 17:56:56 +0200
commit91d14d2a221f619738e4534c1b4266633ce5789d (patch)
treec10b288b9473153fede116204cc861c89dad71a1 /src/eval/value.rs
parent95bae5725cf6495644e2593f8492f1cd0e5bd3c1 (diff)
Evaluate expressions 🧮
Diffstat (limited to 'src/eval/value.rs')
-rw-r--r--src/eval/value.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs
index 51bc55ab..85ac2367 100644
--- a/src/eval/value.rs
+++ b/src/eval/value.rs
@@ -17,6 +17,8 @@ use crate::{DynFuture, Feedback, Pass};
/// A computational value.
#[derive(Clone, PartialEq)]
pub enum Value {
+ /// The result of invalid operations.
+ Error,
/// An identifier: `ident`.
Ident(Ident),
/// A boolean: `true, false`.
@@ -54,6 +56,7 @@ impl Value {
/// The natural-language name of this value for use in error messages.
pub fn name(&self) -> &'static str {
match self {
+ Self::Error => "error",
Self::Ident(_) => "identifier",
Self::Bool(_) => "bool",
Self::Int(_) => "integer",
@@ -111,6 +114,7 @@ impl Spanned<Value> {
impl Debug for Value {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
+ Self::Error => f.pad("<error>"),
Self::Ident(i) => i.fmt(f),
Self::Bool(b) => b.fmt(f),
Self::Int(i) => i.fmt(f),