mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 13:02:20 +00: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:
parent
92132919d1
commit
41288d7642
8 changed files with 100 additions and 47 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue