mirror of
https://github.com/nushell/nushell
synced 2025-01-10 04:09:09 +00:00
38 lines
744 B
Rust
38 lines
744 B
Rust
use super::Expression;
|
|
use crate::{DeclId, Span};
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Call {
|
|
/// identifier of the declaration to call
|
|
pub decl_id: DeclId,
|
|
pub head: Span,
|
|
pub positional: Vec<Expression>,
|
|
pub named: Vec<(String, Option<Expression>)>,
|
|
}
|
|
|
|
impl Default for Call {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl Call {
|
|
pub fn new() -> Call {
|
|
Self {
|
|
decl_id: 0,
|
|
head: Span::unknown(),
|
|
positional: vec![],
|
|
named: vec![],
|
|
}
|
|
}
|
|
|
|
pub fn has_flag(&self, flag_name: &str) -> bool {
|
|
for name in &self.named {
|
|
if flag_name == name.0 {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
false
|
|
}
|
|
}
|