diff --git a/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs b/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs
index cb31434..3d7f9f3 100755
--- a/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs
+++ b/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs
@@ -462,6 +462,7 @@ namespace Mocha.Core
{
public static Guid Minimum { get; } = new Guid("{1ff7be8c-fe48-4154-9028-8ee84b7dc367}");
public static Guid Maximum { get; } = new Guid("{dda6c31d-5bea-41a9-a6bc-0e5c189784da}");
+ public static Guid First { get; } = new Guid("{4a196b8f-ca55-4f3a-a443-f960bfdb3bc6}");
}
public static class RelationalOperators
{
diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs
index ef23045..6472693 100644
--- a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs
+++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs
@@ -15,9 +15,6 @@
// You should have received a copy of the GNU General Public License
// along with Mocha.NET. If not, see .
-using System.ComponentModel.Design;
-using Mocha.Core.Oop;
-
namespace Mocha.Core.MethodImplementations;
public class SelectFromInstanceSetMethodImplementation : MethodImplementation
@@ -27,10 +24,16 @@ public class SelectFromInstanceSetMethodImplementation : MethodImplementation
public string Order;
public object Data;
}
+ private struct OrderableData
+ {
+ public string Order;
+ public T Data;
+ }
public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.SelectFromInstanceSetMethod;
protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method)
{
+ //! FIXME !
Guid methodId = oms.GetGlobalIdentifier(method);
InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class));
@@ -43,32 +46,31 @@ public class SelectFromInstanceSetMethodImplementation : MethodImplementation
}
InstanceHandle usesInstanceSet = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set));
- object? instanceSetValues = context.GetWorkData(usesInstanceSet);
+ // object? instanceSetValues = context.GetWorkData(usesInstanceSet);
+ object? instanceSetValues = oms.Evaluate(context, usesInstanceSet, InstanceHandle.Empty);
InstanceHandle selectionFunction = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Selection_Function));
InstanceHandle setFunction = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Set_Function));
InstanceHandle orderAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute));
- List list = new List();
+ List> list = new List>();
- if (instanceSetValues is IEnumerable)
+ if (instanceSetValues is System.Collections.IEnumerable ie)
{
-
- }
- else if (instanceSetValues is IEnumerable)
- {
- IEnumerable vals = (IEnumerable)instanceSetValues;
- foreach (InstanceWrapper inst in vals)
+ // here we use the non-generic IEnumerable so we can handle cases where
+ // you would pass in an IEnumerable, IEnumerable,
+ // or IEnumerable. Hell, you could even pass in an IEnumerable