mirror of
https://github.com/rm-dr/daisy
synced 2025-07-05 10:09:33 -07:00
Removed =
operator
This commit is contained in:
@ -95,15 +95,6 @@ pub fn evaluate(t: &Expression, context: &mut Context, allow_incomplete: bool) -
|
||||
|
||||
} else {
|
||||
// Move down the tree
|
||||
|
||||
// Don't evaluate the first argument of a define.
|
||||
// This prevents variables from being expanded before a re-assignment.
|
||||
if let Expression::Operator(_, Operator::Define, _) = g {
|
||||
*coords.last_mut().unwrap() += 1;
|
||||
coords.push(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
coords.push(0);
|
||||
}
|
||||
}
|
||||
|
@ -6,24 +6,13 @@ use super::EvalError;
|
||||
use crate::context::Context;
|
||||
|
||||
|
||||
pub fn eval_operator(g: &Expression, context: &mut Context) -> Result<Option<Expression>, (LineLocation, EvalError)> {
|
||||
pub fn eval_operator(g: &Expression, _context: &mut Context) -> Result<Option<Expression>, (LineLocation, EvalError)> {
|
||||
|
||||
let Expression::Operator(op_loc, op, args) = g else {panic!()};
|
||||
|
||||
match op {
|
||||
Operator::Function(_) => unreachable!("Functions are handled seperately."),
|
||||
|
||||
Operator::Define => {
|
||||
if args.len() != 2 { panic!() };
|
||||
let b = &args[1];
|
||||
|
||||
if let Expression::Variable(l, s) = &args[0] {
|
||||
let r = context.push_var(s.clone(), b.clone());
|
||||
if r.is_err() { return Err((*l, EvalError::BadDefineName)); }
|
||||
return Ok(Some(b.clone()));
|
||||
} else { return Err((args[0].get_linelocation(), EvalError::BadDefineName)); }
|
||||
},
|
||||
|
||||
Operator::Negative => {
|
||||
if args.len() != 1 { panic!() };
|
||||
let args = &args[0];
|
||||
|
Reference in New Issue
Block a user