1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::any::Any;
use crate::collections::HashMap;
use crate::hash::Hash;
use crate::vm::Ref;

#[derive(Debug)]
/// A value peeked out of the stack.
pub enum ValueRef<'vm> {
    /// An empty value indicating nothing.
    Unit,
    /// A string.
    String(Ref<'vm, String>),
    /// An array.
    Array(Vec<ValueRef<'vm>>),
    /// An object.
    Object(HashMap<String, ValueRef<'vm>>),
    /// An integer.
    Integer(i64),
    /// A float.
    Float(f64),
    /// A boolean.
    Bool(bool),
    /// A character.
    Char(char),
    /// Reference to an external type.
    External(Ref<'vm, Any>),
    /// Reference to a value type.
    Type(Hash),
    /// A function.
    Fn(Hash),
}