Skip to content

Commit 41ac52d

Browse files
Keavonadamgerhant
authored andcommitted
Apply suggestions from code review
1 parent c623e79 commit 41ac52d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

node-graph/graph-craft/src/document.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub struct OriginalLocation {
8484
pub dependants: Vec<Vec<NodeId>>,
8585
/// A list of flags indicating whether the input is exposed in the UI
8686
pub inputs_exposed: Vec<bool>,
87-
// For automatically inserted convert and into nodes, if there is an error display it on the node it is connect to
87+
/// For automatically inserted Convert and Into nodes, if there is an error, display it on the node it is connect to.
8888
pub auto_convert_index: Option<usize>,
8989
}
9090

node-graph/graph-craft/src/proto.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,23 @@ impl ProtoNetwork {
539539
#[derive(Clone, PartialEq, serde::Serialize, serde::Deserialize)]
540540
pub enum GraphErrorType {
541541
NodeNotFound(NodeId),
542-
UnexpectedGenerics { index: usize, inputs: Vec<Type> },
542+
UnexpectedGenerics {
543+
index: usize,
544+
inputs: Vec<Type>,
545+
},
543546
NoImplementations,
544547
NoConstructor,
545-
// The first vec represents a list of correct NodeIOTypes
546-
// The second vec represents what the input index and what it expects
547-
InvalidImplementations { inputs: String, error_inputs: Vec<Vec<(usize, (Type, Type))>> },
548-
MultipleImplementations { inputs: String, valid: Vec<NodeIOTypes> },
548+
/// The `inputs` represents a formatted list of input indices corresponding to their types.
549+
/// Each element in `error_inputs` represents a valid `NodeIOTypes` implementation.
550+
/// The inner Vec stores the inputs which need to be changed and what type each needs to be changed to.
551+
InvalidImplementations {
552+
inputs: String,
553+
error_inputs: Vec<Vec<(usize, (Type, Type))>>,
554+
},
555+
MultipleImplementations {
556+
inputs: String,
557+
valid: Vec<NodeIOTypes>,
558+
},
549559
}
550560
impl Debug for GraphErrorType {
551561
// TODO: format with the document graph context so the input index is the same as in the graph UI.
@@ -762,7 +772,7 @@ impl TypingContext {
762772
let mut best_errors = usize::MAX;
763773
let mut error_inputs = Vec::new();
764774
for node_io in impls.keys() {
765-
// For errors on convert nodes, add to the input index to it is correct for the node it is connected to
775+
// For errors on Convert nodes, offset the input index so it correctly corresponds to the node it is connected to.
766776
let current_errors = [call_argument]
767777
.into_iter()
768778
.chain(&inputs)

0 commit comments

Comments
 (0)