cl-interpret: VERY rudimentary support for Const and Static
This commit is contained in:
parent
5f57924f23
commit
a646a9e521
@ -47,14 +47,20 @@ impl Interpret for Alias {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Interpret for Const {
|
impl Interpret for Const {
|
||||||
fn interpret(&self, _env: &mut Environment) -> IResult<ConValue> {
|
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
|
||||||
println!("TODO: {self}");
|
let Const { name, ty: _, init } = self;
|
||||||
|
|
||||||
|
let init = init.as_ref().interpret(env)?;
|
||||||
|
env.insert(*name, Some(init));
|
||||||
Ok(ConValue::Empty)
|
Ok(ConValue::Empty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Interpret for Static {
|
impl Interpret for Static {
|
||||||
fn interpret(&self, _env: &mut Environment) -> IResult<ConValue> {
|
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
|
||||||
println!("TODO: {self}");
|
let Static { mutable: _, name, ty: _, init } = self;
|
||||||
|
|
||||||
|
let init = init.as_ref().interpret(env)?;
|
||||||
|
env.insert(*name, Some(init));
|
||||||
Ok(ConValue::Empty)
|
Ok(ConValue::Empty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user