mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Rename record_value_edge to record_value_source
This commit is contained in:
@@ -10,7 +10,7 @@ use core_types::list::List;
|
||||
use core_types::registry::SourceHandle;
|
||||
use core_types::transform::Footprint;
|
||||
use core_types::uuid::NodeId;
|
||||
use core_types::value::{leveled_record_value_edge, record_value_edge};
|
||||
use core_types::value::{leveled_record_value_edge, record_value_source};
|
||||
use core_types::{CacheHash, Color, ContextModification, MemoHash, Type, TypeDescriptor};
|
||||
use dyn_any::DynAny;
|
||||
pub use dyn_any::StaticType;
|
||||
@@ -315,7 +315,7 @@ macro_rules! tagged_value {
|
||||
// ===============
|
||||
// MANUAL VARIANTS
|
||||
// ===============
|
||||
Self::None => Ok(record_value_edge(())),
|
||||
Self::None => Ok(record_value_source(())),
|
||||
Self::TypeDefault(td) => {
|
||||
let name = td.name.as_ref();
|
||||
// The list-typed defaults serve an empty level; the rest construct
|
||||
@@ -334,8 +334,8 @@ macro_rules! tagged_value {
|
||||
// starts from a blank vector, as the legacy path modify synthesized itself.
|
||||
if name == core_types::normalize_type_name(std::any::type_name::<List<Vector>>()) { return Ok(leveled_record_value_edge(vec![Vector::default()])); }
|
||||
check_level!(List<String>, String);
|
||||
if name == core_types::normalize_type_name(std::any::type_name::<DocumentNode>()) { return Ok(record_value_edge(DocumentNode::default())); }
|
||||
if name == core_types::normalize_type_name(std::any::type_name::<Resource>()) { return Ok(record_value_edge(Resource::default())); }
|
||||
if name == core_types::normalize_type_name(std::any::type_name::<DocumentNode>()) { return Ok(record_value_source(DocumentNode::default())); }
|
||||
if name == core_types::normalize_type_name(std::any::type_name::<Resource>()) { return Ok(record_value_source(Resource::default())); }
|
||||
Self::from_type_or_none(&Type::Concrete(td)).to_edge()
|
||||
}
|
||||
Self::F64Array(values) => Ok(leveled_record_value_edge(values)),
|
||||
@@ -345,16 +345,16 @@ macro_rules! tagged_value {
|
||||
// =======================
|
||||
// AUTO-GENERATED VARIANTS
|
||||
// =======================
|
||||
$( Self::$identifier(x) => Ok(record_value_edge(x)), )*
|
||||
$( Self::$identifier(x) => Ok(record_value_source(x)), )*
|
||||
// =======================
|
||||
// NON-SERIALIZED VARIANTS
|
||||
// =======================
|
||||
Self::RenderOutput(x) => Ok(record_value_edge(x)),
|
||||
Self::NodeIdPath(path) => Ok(record_value_edge(path)),
|
||||
Self::DocumentNode(node) => Ok(record_value_edge(node)),
|
||||
Self::ContextModification(modification) => Ok(record_value_edge(modification)),
|
||||
Self::EditorApi(x) => Ok(record_value_edge(x)),
|
||||
Self::ResourceHash(x) => Ok(record_value_edge(x)),
|
||||
Self::RenderOutput(x) => Ok(record_value_source(x)),
|
||||
Self::NodeIdPath(path) => Ok(record_value_source(path)),
|
||||
Self::DocumentNode(node) => Ok(record_value_source(node)),
|
||||
Self::ContextModification(modification) => Ok(record_value_source(modification)),
|
||||
Self::EditorApi(x) => Ok(record_value_source(x)),
|
||||
Self::ResourceHash(x) => Ok(record_value_source(x)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ mod tests {
|
||||
let mut args = args.into_iter();
|
||||
let value = args.next().ok_or(ConstructionError::Arity { expected: 1, got: 0 })?.downcast_record::<String>()?;
|
||||
drop(value);
|
||||
Ok(crate::value::record_value_edge(0u32))
|
||||
Ok(crate::value::record_value_source(0u32))
|
||||
}
|
||||
let entry = RegistryEntry {
|
||||
layout_meta: None,
|
||||
@@ -563,12 +563,12 @@ mod tests {
|
||||
constructor: construct_strlen,
|
||||
};
|
||||
|
||||
let owned = crate::value::record_value_edge("typed".to_string());
|
||||
let owned = crate::value::record_value_source("typed".to_string());
|
||||
assert!(construct(&entry, vec![owned]).is_ok());
|
||||
|
||||
assert_eq!(construct(&entry, vec![]).unwrap_err(), ConstructionError::Arity { expected: 1, got: 0 });
|
||||
|
||||
let mistyped = crate::value::record_value_edge(1.0f64);
|
||||
let mistyped = crate::value::record_value_source(1.0f64);
|
||||
assert_eq!(
|
||||
construct(&entry, vec![mistyped]).unwrap_err(),
|
||||
ConstructionError::Type {
|
||||
|
||||
@@ -33,8 +33,8 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// The native record edge of a constant.
|
||||
pub fn record_value_edge<T: Clone + Send + Sync + dyn_any::StaticTypeSized + 'static>(value: T) -> crate::registry::SourceHandle
|
||||
/// The native record source of a constant.
|
||||
pub fn record_value_source<T: Clone + Send + Sync + dyn_any::StaticTypeSized + 'static>(value: T) -> crate::registry::SourceHandle
|
||||
where
|
||||
T::Static: Clone + Send + Sync,
|
||||
{
|
||||
|
||||
@@ -1016,7 +1016,7 @@ mod graphene_test {
|
||||
use core_types::node::{BatchStatus, Node};
|
||||
use core_types::record::{Layout, LiftedSource, RecordValue, serve_input};
|
||||
use core_types::registry::{ErasedRecordNode, construct};
|
||||
use core_types::value::record_value_edge;
|
||||
use core_types::value::record_value_source;
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
fn scope_fixture(arena: &Arena) -> EvalScope<'_> {
|
||||
@@ -1111,7 +1111,7 @@ mod graphene_test {
|
||||
let ctx = ContextImpl::root(&scope);
|
||||
|
||||
let entries = super::_logical_or_mod::logical_or_entries();
|
||||
let mut wired = construct(&entries[0], vec![record_value_edge(true), record_value_edge(false)]).unwrap();
|
||||
let mut wired = construct(&entries[0], vec![record_value_source(true), record_value_source(false)]).unwrap();
|
||||
let layout = out_layout::<bool>();
|
||||
wired.set_layout(core_types::record::RecordLayout {
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
@@ -1157,7 +1157,7 @@ mod graphene_test {
|
||||
);
|
||||
assert_eq!(entries[3].io.return_value, core_types::registry::record_type::<DVec2>());
|
||||
|
||||
let mut wired = construct(&entries[0], vec![record_value_edge(1.5f64), record_value_edge(2.5f64)]).unwrap();
|
||||
let mut wired = construct(&entries[0], vec![record_value_source(1.5f64), record_value_source(2.5f64)]).unwrap();
|
||||
let layout = out_layout::<f64>();
|
||||
wired.set_layout(core_types::record::RecordLayout {
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
|
||||
Reference in New Issue
Block a user