nushell/crates/nu-engine/src/call_info.rs
Jonathan Turner 073e5727c6
Switch to "engine-p" (#3270)
* WIP

* WIP

* first builds

* Tests pass
2021-04-06 11:19:43 -05:00

27 lines
671 B
Rust

use crate::evaluate::evaluate_args::evaluate_args;
use crate::evaluation_context::EvaluationContext;
use nu_errors::ShellError;
use nu_protocol::hir;
use nu_protocol::CallInfo;
use nu_source::Tag;
#[derive(Debug, Clone)]
pub struct UnevaluatedCallInfo {
pub args: hir::Call,
pub name_tag: Tag,
}
impl UnevaluatedCallInfo {
pub fn evaluate(self, ctx: &EvaluationContext) -> Result<CallInfo, ShellError> {
let args = evaluate_args(&self.args, ctx)?;
Ok(CallInfo {
args,
name_tag: self.name_tag,
})
}
pub fn switch_present(&self, switch: &str) -> bool {
self.args.switch_preset(switch)
}
}