mirror of https://github.com/rm-dr/daisy
commit
39ab47530e
|
@ -28,7 +28,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daisycalc"
|
name = "daisycalc"
|
||||||
version = "1.1.3"
|
version = "1.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"num",
|
"num",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "daisycalc"
|
name = "daisycalc"
|
||||||
version = "1.1.3"
|
version = "1.1.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "buildscript/main.rs"
|
build = "buildscript/main.rs"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||||
|
|
||||||
if args.len() != 1 {panic!()};
|
if args.len() != 1 {panic!()};
|
||||||
let a = &args[0];
|
let a = &args[0];
|
||||||
|
let mut args_ll = op_loc.clone();
|
||||||
|
|
||||||
if sh_vars.len() == 1 {
|
if sh_vars.len() == 1 {
|
||||||
if let Expression::Tuple(l, v) = a {
|
if let Expression::Tuple(l, v) = a {
|
||||||
|
@ -28,6 +29,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
args_ll += a.get_linelocation();
|
||||||
context.add_shadow(sh_vars[0].clone(), Some(a.clone()));
|
context.add_shadow(sh_vars[0].clone(), Some(a.clone()));
|
||||||
} else {
|
} else {
|
||||||
let Expression::Tuple(l, v) = a else {
|
let Expression::Tuple(l, v) = a else {
|
||||||
|
@ -46,16 +48,26 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < sh_vars.len() {
|
while i < sh_vars.len() {
|
||||||
|
args_ll += v[i].get_linelocation();
|
||||||
context.add_shadow(sh_vars[i].clone(), Some(v[i].clone()));
|
context.add_shadow(sh_vars[i].clone(), Some(v[i].clone()));
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let r = evaluate(context, &exp)?;
|
let r = evaluate(context, &exp);
|
||||||
context.clear_shadow();
|
context.clear_shadow();
|
||||||
|
|
||||||
return Ok(Some(r));
|
match r {
|
||||||
|
Ok(mut r) => {
|
||||||
|
r.set_linelocation(&args_ll);
|
||||||
|
return Ok(Some(r));
|
||||||
|
},
|
||||||
|
|
||||||
|
Err( (_, err) ) => {
|
||||||
|
return Err((args_ll, err));
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Operator::Negative => {
|
Operator::Negative => {
|
||||||
|
|
Loading…
Reference in New Issue