Cleanup parsing of use and hide commands (#705)

This commit is contained in:
Jakub Žádník
2022-01-10 03:39:25 +02:00
committed by GitHub
parent 3a17b60862
commit 733b2836f1
6 changed files with 321 additions and 168 deletions

View File

@ -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) => {