mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 16:38:12 +08:00
Delete the Ref wire type and its lend edge surface
This commit is contained in:
@@ -323,7 +323,6 @@ pub(crate) fn property_from_type(
|
|||||||
Type::Generic(_) => vec![TextLabel::new("Generic Type (Not Supported)").widget_instance()].into(),
|
Type::Generic(_) => vec![TextLabel::new("Generic Type (Not Supported)").widget_instance()].into(),
|
||||||
Type::Fn(_, out) => return property_from_type(node_id, index, out, number_options, unit, display_decimal_places, step, context),
|
Type::Fn(_, out) => return property_from_type(node_id, index, out, number_options, unit, display_decimal_places, step, context),
|
||||||
Type::Future(out) => return property_from_type(node_id, index, out, number_options, unit, display_decimal_places, step, context),
|
Type::Future(out) => return property_from_type(node_id, index, out, number_options, unit, display_decimal_places, step, context),
|
||||||
Type::Ref(inner) => return property_from_type(node_id, index, inner, number_options, unit, display_decimal_places, step, context),
|
|
||||||
Type::Record(inner) => return property_from_type(node_id, index, inner, number_options, unit, display_decimal_places, step, context),
|
Type::Record(inner) => return property_from_type(node_id, index, inner, number_options, unit, display_decimal_places, step, context),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -434,7 +434,6 @@ macro_rules! tagged_value {
|
|||||||
pub fn from_type(input: &Type) -> Option<Self> {
|
pub fn from_type(input: &Type) -> Option<Self> {
|
||||||
match input {
|
match input {
|
||||||
Type::Generic(_) => None,
|
Type::Generic(_) => None,
|
||||||
Type::Ref(inner) => Self::from_type(inner),
|
|
||||||
Type::Record(inner) => Self::from_type(inner),
|
Type::Record(inner) => Self::from_type(inner),
|
||||||
Type::Concrete(concrete_type) => {
|
Type::Concrete(concrete_type) => {
|
||||||
let name = concrete_type.name.as_ref();
|
let name = concrete_type.name.as_ref();
|
||||||
@@ -696,7 +695,6 @@ impl TaggedValue {
|
|||||||
|
|
||||||
match ty {
|
match ty {
|
||||||
Type::Generic(_) => None,
|
Type::Generic(_) => None,
|
||||||
Type::Ref(_) => None,
|
|
||||||
Type::Record(_) => None,
|
Type::Record(_) => None,
|
||||||
Type::Concrete(concrete_type) => {
|
Type::Concrete(concrete_type) => {
|
||||||
let ty = concrete_type.id?;
|
let ty = concrete_type.id?;
|
||||||
|
|||||||
@@ -906,7 +906,6 @@ fn valid_type(from: &Type, to: &Type) -> bool {
|
|||||||
// More details explained here: <https://github.com/GraphiteEditor/Graphite/issues/1741>
|
// More details explained here: <https://github.com/GraphiteEditor/Graphite/issues/1741>
|
||||||
(Type::Fn(in1, out1), Type::Fn(in2, out2)) => valid_type(out2, out1) && valid_type(in1, in2),
|
(Type::Fn(in1, out1), Type::Fn(in2, out2)) => valid_type(out2, out1) && valid_type(in1, in2),
|
||||||
// A lend edge is substitutable exactly when the lent values are.
|
// A lend edge is substitutable exactly when the lent values are.
|
||||||
(Type::Ref(in1), Type::Ref(in2)) => valid_type(in1, in2),
|
|
||||||
// A record edge is substitutable exactly when the elements are.
|
// A record edge is substitutable exactly when the elements are.
|
||||||
(Type::Record(in1), Type::Record(in2)) => valid_type(in1, in2),
|
(Type::Record(in1), Type::Record(in2)) => valid_type(in1, in2),
|
||||||
// If either the proposed input or the allowed input are generic, we allow the substitution (meaning this is a valid subtype).
|
// If either the proposed input or the allowed input are generic, we allow the substitution (meaning this is a valid subtype).
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ pub use crate::NodeIOTypes;
|
|||||||
pub type ErasedNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = T> + Send + Sync;
|
pub type ErasedNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = T> + Send + Sync;
|
||||||
#[cfg(target_family = "wasm")]
|
#[cfg(target_family = "wasm")]
|
||||||
pub type ErasedNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = T>;
|
pub type ErasedNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = T>;
|
||||||
#[cfg(not(target_family = "wasm"))]
|
|
||||||
pub type ErasedLendNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = &'c T> + Send + Sync;
|
|
||||||
#[cfg(target_family = "wasm")]
|
|
||||||
pub type ErasedLendNode<T> = dyn for<'c> Node<ContextImpl<'c>, Output = &'c T>;
|
|
||||||
|
|
||||||
/// Element-independent by erasure; the wire's `Type::Record(El)` keeps element reads proven at wiring.
|
/// Element-independent by erasure; the wire's `Type::Record(El)` keeps element reads proven at wiring.
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
@@ -94,14 +90,6 @@ pub fn edge_type<T: 'static>() -> Type {
|
|||||||
Type::Fn(Box::new(concrete!(Context)), Box::new(concrete!(T)))
|
Type::Fn(Box::new(concrete!(Context)), Box::new(concrete!(T)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ref_type<T: 'static>() -> Type {
|
|
||||||
Type::Ref(Box::new(concrete!(T)))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn lend_edge_type<T: 'static>() -> Type {
|
|
||||||
Type::Fn(Box::new(concrete!(Context)), Box::new(ref_type::<T>()))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn record_type<T: 'static>() -> Type {
|
pub fn record_type<T: 'static>() -> Type {
|
||||||
Type::Record(Box::new(concrete!(T)))
|
Type::Record(Box::new(concrete!(T)))
|
||||||
}
|
}
|
||||||
@@ -112,10 +100,7 @@ pub fn record_edge_type<T: 'static>() -> Type {
|
|||||||
|
|
||||||
/// The record edge type of a token row, generic over the element.
|
/// The record edge type of a token row, generic over the element.
|
||||||
pub fn generic_record_edge_type(name: &'static str) -> Type {
|
pub fn generic_record_edge_type(name: &'static str) -> Type {
|
||||||
Type::Fn(
|
Type::Fn(Box::new(concrete!(Context)), Box::new(Type::Record(Box::new(Type::Generic(std::borrow::Cow::Borrowed(name))))))
|
||||||
Box::new(concrete!(Context)),
|
|
||||||
Box::new(Type::Record(Box::new(Type::Generic(std::borrow::Cow::Borrowed(name))))),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cache_key<C: CacheHash + ?Sized>(ctx: &C) -> u64 {
|
pub fn cache_key<C: CacheHash + ?Sized>(ctx: &C) -> u64 {
|
||||||
@@ -217,10 +202,6 @@ impl EdgeHandle {
|
|||||||
Self::new_erased(node, edge_type::<T>())
|
Self::new_erased(node, edge_type::<T>())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_ref<T: 'static>(node: std::sync::Arc<ErasedLendNode<T>>) -> Self {
|
|
||||||
Self::new_erased(node, lend_edge_type::<T>())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn new_record<T: 'static>(node: std::sync::Arc<ErasedRecordNode>) -> Self {
|
pub fn new_record<T: 'static>(node: std::sync::Arc<ErasedRecordNode>) -> Self {
|
||||||
Self::new_erased(node, record_edge_type::<T>())
|
Self::new_erased(node, record_edge_type::<T>())
|
||||||
}
|
}
|
||||||
@@ -265,10 +246,6 @@ impl EdgeHandle {
|
|||||||
self.downcast_erased(edge_type::<T>())
|
self.downcast_erased(edge_type::<T>())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn downcast_lend<T: 'static>(self) -> Result<SharedEdge<ErasedLendNode<T>>, ConstructionError> {
|
|
||||||
self.downcast_erased(lend_edge_type::<T>())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn downcast_record<T: 'static>(self) -> Result<SharedEdge<ErasedRecordNode>, ConstructionError> {
|
pub fn downcast_record<T: 'static>(self) -> Result<SharedEdge<ErasedRecordNode>, ConstructionError> {
|
||||||
self.downcast_erased(record_edge_type::<T>())
|
self.downcast_erased(record_edge_type::<T>())
|
||||||
}
|
}
|
||||||
@@ -430,9 +407,9 @@ mod tests {
|
|||||||
let scope = scope_fixture(&generations, &arena);
|
let scope = scope_fixture(&generations, &arena);
|
||||||
let ctx = ContextImpl::root(&scope);
|
let ctx = ContextImpl::root(&scope);
|
||||||
|
|
||||||
let lending = EdgeHandle::new_ref(Arc::new(LendNode("held".to_string())) as Arc<ErasedLendNode<String>>);
|
let node: Arc<ErasedSplitEdge> = Arc::new(SplitNode {
|
||||||
let upstream = lending.downcast_lend::<String>().unwrap();
|
content: LendNode("held".to_string()),
|
||||||
let node: Arc<ErasedSplitEdge> = Arc::new(SplitNode { content: upstream });
|
});
|
||||||
let handle = EdgeHandle::new_erased(node, concrete!(SplitBorrow<'static>));
|
let handle = EdgeHandle::new_erased(node, concrete!(SplitBorrow<'static>));
|
||||||
assert_eq!(*handle.ty(), concrete!(SplitBorrow<'static>));
|
assert_eq!(*handle.ty(), concrete!(SplitBorrow<'static>));
|
||||||
|
|
||||||
@@ -572,15 +549,6 @@ mod tests {
|
|||||||
found: Box::new(edge_type::<f64>()),
|
found: Box::new(edge_type::<f64>()),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let lent = EdgeHandle::new_ref(Arc::new(LendNode("typed".to_string())) as Arc<ErasedLendNode<String>>);
|
|
||||||
assert_eq!(
|
|
||||||
construct(&entry, vec![lent]).unwrap_err(),
|
|
||||||
ConstructionError::Type {
|
|
||||||
expected: Box::new(edge_type::<String>()),
|
|
||||||
found: Box::new(lend_edge_type::<String>()),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ pub enum Type {
|
|||||||
Fn(Box<Type>, Box<Type>),
|
Fn(Box<Type>, Box<Type>),
|
||||||
/// Represents a future which promises to return the inner type.
|
/// Represents a future which promises to return the inner type.
|
||||||
Future(Box<Type>),
|
Future(Box<Type>),
|
||||||
Ref(Box<Type>),
|
|
||||||
/// A packed record wire over the element type; the layout stays node-resident metadata.
|
/// A packed record wire over the element type; the layout stays node-resident metadata.
|
||||||
Record(Box<Type>),
|
Record(Box<Type>),
|
||||||
}
|
}
|
||||||
@@ -311,7 +310,6 @@ impl Type {
|
|||||||
Self::Concrete(ty) => Some(ty.size),
|
Self::Concrete(ty) => Some(ty.size),
|
||||||
Self::Fn(_, _) => None,
|
Self::Fn(_, _) => None,
|
||||||
Self::Future(_) => None,
|
Self::Future(_) => None,
|
||||||
Self::Ref(_) => None,
|
|
||||||
Self::Record(_) => None,
|
Self::Record(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,7 +320,6 @@ impl Type {
|
|||||||
Self::Concrete(ty) => Some(ty.align),
|
Self::Concrete(ty) => Some(ty.align),
|
||||||
Self::Fn(_, _) => None,
|
Self::Fn(_, _) => None,
|
||||||
Self::Future(_) => None,
|
Self::Future(_) => None,
|
||||||
Self::Ref(_) => None,
|
|
||||||
Self::Record(_) => None,
|
Self::Record(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,7 +330,6 @@ impl Type {
|
|||||||
Self::Concrete(_) => self,
|
Self::Concrete(_) => self,
|
||||||
Self::Fn(_, output) => output.nested_type(),
|
Self::Fn(_, output) => output.nested_type(),
|
||||||
Self::Future(output) => output.nested_type(),
|
Self::Future(output) => output.nested_type(),
|
||||||
Self::Ref(inner) => inner.nested_type(),
|
|
||||||
Self::Record(inner) => inner.nested_type(),
|
Self::Record(inner) => inner.nested_type(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +343,6 @@ impl Type {
|
|||||||
Self::Concrete(_) => None,
|
Self::Concrete(_) => None,
|
||||||
Self::Fn(_, output) => output.replace_nested(f),
|
Self::Fn(_, output) => output.replace_nested(f),
|
||||||
Self::Future(output) => output.replace_nested(f),
|
Self::Future(output) => output.replace_nested(f),
|
||||||
Self::Ref(inner) => inner.replace_nested(f),
|
|
||||||
Self::Record(inner) => inner.replace_nested(f),
|
Self::Record(inner) => inner.replace_nested(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,7 +353,6 @@ impl Type {
|
|||||||
Type::Concrete(ty) => simplify_identifier_name(&ty.name),
|
Type::Concrete(ty) => simplify_identifier_name(&ty.name),
|
||||||
Type::Fn(call_arg, return_value) => format!("{} called with {}", return_value.identifier_name(), call_arg.identifier_name()),
|
Type::Fn(call_arg, return_value) => format!("{} called with {}", return_value.identifier_name(), call_arg.identifier_name()),
|
||||||
Type::Future(ty) => ty.identifier_name(),
|
Type::Future(ty) => ty.identifier_name(),
|
||||||
Type::Ref(ty) => ty.identifier_name(),
|
|
||||||
Type::Record(ty) => ty.identifier_name(),
|
Type::Record(ty) => ty.identifier_name(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -454,7 +448,6 @@ impl std::fmt::Display for Type {
|
|||||||
Type::Concrete(ty) => write!(f, "{ty}"),
|
Type::Concrete(ty) => write!(f, "{ty}"),
|
||||||
Type::Fn(_, return_value) => write!(f, "{return_value}"),
|
Type::Fn(_, return_value) => write!(f, "{return_value}"),
|
||||||
Type::Future(ty) => write!(f, "{ty}"),
|
Type::Future(ty) => write!(f, "{ty}"),
|
||||||
Type::Ref(ty) => write!(f, "{ty}"),
|
|
||||||
Type::Record(ty) => write!(f, "{ty}"),
|
Type::Record(ty) => write!(f, "{ty}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2149,54 +2149,24 @@ fn entries_tokens(parsed: &ParsedNodeFn, struct_name: &Ident, data_field_generic
|
|||||||
return quote!();
|
return quote!();
|
||||||
}
|
}
|
||||||
|
|
||||||
let ref_output_inner = match slot_value_type(&parsed.output_type) {
|
if matches!(slot_value_type(&parsed.output_type), Type::Reference(_)) {
|
||||||
Type::Reference(reference) => Some((*reference.elem).clone()),
|
return quote!();
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
if let Some(inner) = &ref_output_inner {
|
|
||||||
let ctx_ident = context_param(parsed).map(|ctx| ctx.ident.clone());
|
|
||||||
let open_generics = parsed.fn_generics.iter().filter_map(|param| match param {
|
|
||||||
GenericParam::Type(type_param) if Some(&type_param.ident) != ctx_ident.as_ref() => Some(&type_param.ident),
|
|
||||||
_ => None,
|
|
||||||
});
|
|
||||||
if open_generics.into_iter().any(|generic| type_contains_ident(inner, generic)) {
|
|
||||||
return quote!();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let fn_name = &parsed.fn_name;
|
let fn_name = &parsed.fn_name;
|
||||||
let entries_name = format_ident!("{}_entries", fn_name);
|
let entries_name = format_ident!("{}_entries", fn_name);
|
||||||
let arity = regular_fields.len();
|
let arity = regular_fields.len();
|
||||||
let names: Vec<&Ident> = regular_fields.iter().map(|field| &field.pat_ident.ident).collect();
|
let names: Vec<&Ident> = regular_fields.iter().map(|field| &field.pat_ident.ident).collect();
|
||||||
let lend_flags: Vec<bool> = regular_fields
|
|
||||||
.iter()
|
|
||||||
.map(|field| matches!(&field.ty, ParsedFieldType::Regular(RegularParsedField { lend: Some(_), .. })))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let entries = rows.iter().map(|row| {
|
let entries = rows.iter().map(|row| {
|
||||||
let input_types = row.iter().zip(&lend_flags).map(|(ty, lend)| match lend {
|
let input_types = row.iter().map(|ty| quote!(gcore::registry::edge_type::<#ty>()));
|
||||||
true => quote!(gcore::registry::lend_edge_type::<#ty>()),
|
let edge_types = row.iter().map(|ty| quote!(gcore::registry::SharedEdge<gcore::registry::ErasedNode<#ty>>));
|
||||||
false => quote!(gcore::registry::edge_type::<#ty>()),
|
|
||||||
});
|
|
||||||
let edge_types = row.iter().zip(&lend_flags).map(|(ty, lend)| match lend {
|
|
||||||
true => quote!(gcore::registry::SharedEdge<gcore::registry::ErasedLendNode<#ty>>),
|
|
||||||
false => quote!(gcore::registry::SharedEdge<gcore::registry::ErasedNode<#ty>>),
|
|
||||||
});
|
|
||||||
let output = quote!(<#struct_name<#(#edge_types),*> as gcore::node::Node<gcore::context::ContextImpl<'static>>>::Output);
|
let output = quote!(<#struct_name<#(#edge_types),*> as gcore::node::Node<gcore::context::ContextImpl<'static>>>::Output);
|
||||||
let (io_output, construct) = match &ref_output_inner {
|
let (io_output, construct) = (
|
||||||
Some(inner) => (
|
quote!(gcore::concrete!(#output)),
|
||||||
quote!(gcore::registry::ref_type::<#inner>()),
|
quote!(Ok(gcore::registry::EdgeHandle::new(::std::sync::Arc::new(#struct_name::new(#(#names),*)) as ::std::sync::Arc<gcore::registry::ErasedNode<#output>>))),
|
||||||
quote!(Ok(gcore::registry::EdgeHandle::new_ref(::std::sync::Arc::new(#struct_name::new(#(#names),*)) as ::std::sync::Arc<gcore::registry::ErasedLendNode<#inner>>))),
|
);
|
||||||
),
|
let downcasts = names.iter().zip(row.iter()).map(|(name, ty)| quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;));
|
||||||
None => (
|
|
||||||
quote!(gcore::concrete!(#output)),
|
|
||||||
quote!(Ok(gcore::registry::EdgeHandle::new(::std::sync::Arc::new(#struct_name::new(#(#names),*)) as ::std::sync::Arc<gcore::registry::ErasedNode<#output>>))),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
let downcasts = names.iter().zip(row.iter()).zip(&lend_flags).map(|((name, ty), lend)| match lend {
|
|
||||||
true => quote!(let #name = inputs.next().unwrap().downcast_lend::<#ty>()?;),
|
|
||||||
false => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
|
||||||
});
|
|
||||||
quote! {
|
quote! {
|
||||||
gcore::registry::RegistryEntry {
|
gcore::registry::RegistryEntry {
|
||||||
io: gcore::registry::NodeIOTypes::new(
|
io: gcore::registry::NodeIOTypes::new(
|
||||||
@@ -2417,7 +2387,7 @@ fn routing_entries_tokens(parsed: &ParsedNodeFn, struct_name: &Ident, regular_fi
|
|||||||
return quote!(gcore::registry::generic_record_edge_type(#token_name));
|
return quote!(gcore::registry::generic_record_edge_type(#token_name));
|
||||||
}
|
}
|
||||||
match &field.ty {
|
match &field.ty {
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(gcore::registry::lend_edge_type::<#ty>()),
|
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
||||||
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(gcore::registry::edge_type::<#output_type>()),
|
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(gcore::registry::edge_type::<#output_type>()),
|
||||||
}
|
}
|
||||||
@@ -2444,7 +2414,7 @@ fn routing_entries_tokens(parsed: &ParsedNodeFn, struct_name: &Ident, regular_fi
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
match &field.ty {
|
match &field.ty {
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(let #name = inputs.next().unwrap().downcast_lend::<#ty>()?;),
|
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
||||||
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#output_type>()?;),
|
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#output_type>()?;),
|
||||||
}
|
}
|
||||||
@@ -2511,7 +2481,7 @@ fn record_opaque_entries_tokens(parsed: &ParsedNodeFn, struct_name: &Ident, regu
|
|||||||
return quote!(gcore::registry::generic_record_edge_type("T"));
|
return quote!(gcore::registry::generic_record_edge_type("T"));
|
||||||
}
|
}
|
||||||
match &field.ty {
|
match &field.ty {
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(gcore::registry::lend_edge_type::<#ty>()),
|
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(gcore::registry::edge_type::<#ty>()),
|
||||||
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(gcore::registry::edge_type::<#output_type>()),
|
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(gcore::registry::edge_type::<#output_type>()),
|
||||||
}
|
}
|
||||||
@@ -2532,7 +2502,7 @@ fn record_opaque_entries_tokens(parsed: &ParsedNodeFn, struct_name: &Ident, regu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
match &field.ty {
|
match &field.ty {
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(let #name = inputs.next().unwrap().downcast_lend::<#ty>()?;),
|
ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
||||||
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
ParsedFieldType::Regular(RegularParsedField { ty, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#ty>()?;),
|
||||||
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#output_type>()?;),
|
ParsedFieldType::Node(NodeParsedField { output_type, .. }) => quote!(let #name = inputs.next().unwrap().downcast::<#output_type>()?;),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ mod tests {
|
|||||||
use core_types::SourceId;
|
use core_types::SourceId;
|
||||||
use core_types::arena::Arena;
|
use core_types::arena::Arena;
|
||||||
use core_types::context::{ContextImpl, EvalScope};
|
use core_types::context::{ContextImpl, EvalScope};
|
||||||
use core_types::registry::{EdgeHandle, ErasedLendNode, ErasedNode, ErasedRecordNode};
|
use core_types::registry::{EdgeHandle, ErasedNode, ErasedRecordNode};
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
struct CountingNode(AtomicU32);
|
struct CountingNode(AtomicU32);
|
||||||
|
|||||||
Reference in New Issue
Block a user