Skip to content

Commit 379af0e

Browse files
committed
Bugfix method call changing overload wasn't removing the proper inputs and outputs
1 parent 7c4b9d3 commit 379af0e

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/NodeDev.Core/Nodes/MethodCall.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,24 @@ public override void SelectOverload(AlternateOverload overload, out List<Connect
9595
}
9696

9797
// assumes that every parameters is a real type
98-
var method = parentType.GetMethods().FirstOrDefault(x => x.Name == TargetMethod.Name && overload.Parameters.Select(x => x.ParameterType).SequenceEqual(overload.Parameters.Select(x => x.ParameterType))); ;
98+
var method = parentType.GetMethods().FirstOrDefault(x => x.Name == TargetMethod.Name && overload.Parameters.Select(x => x.ParameterType).SequenceEqual(overload.Parameters.Select(x => x.ParameterType)));
9999
if (method == null)
100100
throw new Exception("Unable to find method overload");
101101

102102
if (method.ReturnType != overload.ReturnType)
103103
throw new Exception("Return type mismatch");
104104

105105
// remove the old connections, except the Exec inputs and outputs
106-
removedConnections = Inputs.Skip(1).Concat(Outputs.Skip(1)).ToList();
106+
removedConnections = Inputs.Skip(2).Append(Inputs[0]).Concat(Outputs.Skip(1)).ToList();
107+
Inputs.RemoveAt(0);
107108
Inputs.RemoveRange(1, Inputs.Count - 1);
108109
Outputs.RemoveRange(1, Outputs.Count - 1);
109110

110111
// Set the new method, this will add all the required inputs and outputs
111112
SetMethodTarget(method);
112113

113114
// return the new connections
114-
newConnections = Inputs.Skip(1).Concat(Outputs.Skip(1)).ToList();
115+
newConnections = Inputs.Take(1).Concat(Inputs.Skip(2)).Concat(Outputs.Skip(1)).ToList();
115116
}
116117

117118
public void SetMethodTarget(IMethodInfo methodInfo)

src/NodeDev.Core/Types/RealMethodParameterInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public TypeBase ParameterType
4040
{
4141
get
4242
{
43-
if (ParameterInfo.ParameterType.IsGenericType)
43+
if(ParameterInfo.ParameterType.IsGenericParameter)
44+
return DeclaringRealType.Generics[ParameterInfo.ParameterType.GenericParameterPosition];
45+
else if (ParameterInfo.ParameterType.IsGenericType)
4446
{
4547
var generics = ReplaceGenericsRecursively(ParameterInfo.ParameterType).ToArray();
4648
return TypeFactory.Get(ParameterInfo.ParameterType, generics);

0 commit comments

Comments
 (0)