mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 02:07:55 +02:00
Cleanup parsing of use and hide commands (#705)
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
use super::{Expr, Operator, Statement};
|
||||
use crate::ast::ImportPattern;
|
||||
use crate::{engine::StateWorkingSet, BlockId, Signature, Span, Type, VarId, IN_VARIABLE_ID};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -96,6 +97,13 @@ impl Expression {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_import_pattern(&self) -> Option<ImportPattern> {
|
||||
match &self.expr {
|
||||
Expr::ImportPattern(pattern) => Some(pattern.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_in_variable(&self, working_set: &StateWorkingSet) -> bool {
|
||||
match &self.expr {
|
||||
Expr::BinaryOp(left, _, right) => {
|
||||
|
Reference in New Issue
Block a user