mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Fix the Into nodes, which were broken but unused except in GPU nodes (#2480)
* Prototype document network level into node insertion * Fix generic type resolution * Cleanup * Remove network nesting
This commit is contained in:
@@ -293,7 +293,7 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn nested_type(self) -> Type {
|
||||
pub fn nested_type(&self) -> &Type {
|
||||
match self {
|
||||
Self::Generic(_) => self,
|
||||
Self::Concrete(_) => self,
|
||||
@@ -301,6 +301,18 @@ impl Type {
|
||||
Self::Future(output) => output.nested_type(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn replace_nested(&mut self, f: impl Fn(&Type) -> Option<Type>) -> Option<Type> {
|
||||
if let Some(replacement) = f(self) {
|
||||
return Some(std::mem::replace(self, replacement));
|
||||
}
|
||||
match self {
|
||||
Self::Generic(_) => None,
|
||||
Self::Concrete(_) => None,
|
||||
Self::Fn(_, output) => output.replace_nested(f),
|
||||
Self::Future(output) => output.replace_nested(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn format_type(ty: &str) -> String {
|
||||
|
||||
Reference in New Issue
Block a user