Skip to content

Commit

Permalink
add FindMethods for collection of interfaces #61
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed Jun 30, 2021
1 parent 3d8b8a0 commit a70b40b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backend/mana.backend.ishtar.light/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace ishtar
{
using System;
using System.Collections.Generic;
using mana.exceptions;
using mana.runtime;

public static class Extensions
{
public static IEnumerable<RuntimeIshtarMethod> FindMethods(this IEnumerable<RuntimeIshtarInterface> @interfaces, string fullyName)
{
var list = new List<RuntimeIshtarMethod>();
foreach (var @interface in @interfaces)
{
var result = @interface.FindMethod(fullyName, x => x.Name.Equals(fullyName));
if (result is null)
continue;
if (result is not RuntimeIshtarMethod m)
throw new TypeMismatchException();
list.Add(m);
}
return list;
}
}
}

0 comments on commit a70b40b

Please sign in to comment.