Update eval.rs

This commit is contained in:
Shunsuke Shibayama 2022-12-15 17:07:25 +09:00
parent f2856c588f
commit 68a3fd6730

View file

@ -1256,10 +1256,24 @@ impl Context {
let is_method = subr.sig_t().self_t().is_some(); let is_method = subr.sig_t().self_t().is_some();
let mut pos_args = vec![]; let mut pos_args = vec![];
if is_method { if is_method {
pos_args.push(ValueObj::try_from(lhs).unwrap()); match ValueObj::try_from(lhs) {
Ok(value) => {
pos_args.push(value);
}
Err(_) => {
return feature_error!(self, t_loc, "??");
}
}
} }
for pos_arg in args.into_iter() { for pos_arg in args.into_iter() {
pos_args.push(ValueObj::try_from(pos_arg).unwrap()); match ValueObj::try_from(pos_arg) {
Ok(value) => {
pos_args.push(value);
}
Err(_) => {
return feature_error!(self, t_loc, "??");
}
}
} }
let args = ValueArgs::new(pos_args, dict! {}); let args = ValueArgs::new(pos_args, dict! {});
let t = self.call(subr, args, t_loc)?; let t = self.call(subr, args, t_loc)?;
@ -1274,7 +1288,14 @@ impl Context {
if let ValueObj::Subr(subr) = obj { if let ValueObj::Subr(subr) = obj {
let mut pos_args = vec![]; let mut pos_args = vec![];
for pos_arg in args.into_iter() { for pos_arg in args.into_iter() {
pos_args.push(ValueObj::try_from(pos_arg).unwrap()); match ValueObj::try_from(pos_arg) {
Ok(value) => {
pos_args.push(value);
}
Err(_) => {
return feature_error!(self, t_loc, "??");
}
}
} }
let args = ValueArgs::new(pos_args, dict! {}); let args = ValueArgs::new(pos_args, dict! {});
let t = self.call(subr, args, t_loc)?; let t = self.call(subr, args, t_loc)?;