feat: SCC analysis (thunk capture WIP)

This commit is contained in:
2025-06-17 11:53:54 +08:00
parent b2d2490327
commit 7f6848c9e5
19 changed files with 501 additions and 458 deletions

View File

@@ -14,7 +14,7 @@ use super::super::public as p;
use super::Value;
#[repr(transparent)]
#[derive(Constructor, Clone, PartialEq)]
#[derive(Constructor, Clone, PartialEq, Debug)]
pub struct AttrSet {
data: HashMap<EcoString, Value>,
}
@@ -61,7 +61,7 @@ impl AttrSet {
let item = item?;
let Some(Value::AttrSet(attrs)) = data.get(&item) else {
return Err(Error::EvalError(format!(
"{} not found",
"attribute {} not found",
Symbol::from(item)
)));
};
@@ -73,7 +73,10 @@ impl AttrSet {
.ok_or_else(|| Error::EvalError(format!("{} not found", Symbol::from(last))))
}
pub fn has_attr(&self, mut path: impl DoubleEndedIterator<Item = Result<EcoString>>) -> Result<bool> {
pub fn has_attr(
&self,
mut path: impl DoubleEndedIterator<Item = Result<EcoString>>,
) -> Result<bool> {
let mut data = &self.data;
let last = path.nth_back(0).unwrap();
for item in path {