From c957cdf9ca289f10cee89d7c41ab20cd13d9d90e Mon Sep 17 00:00:00 2001 From: triton Date: Thu, 24 Jan 2013 01:09:03 +0000 Subject: [PATCH] Change FindFunction to return an enumeration of all functions and use Linq to do the query. --- src/Generator/LibraryHelpers.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Generator/LibraryHelpers.cs b/src/Generator/LibraryHelpers.cs index cddc78e4..adb535a8 100644 --- a/src/Generator/LibraryHelpers.cs +++ b/src/Generator/LibraryHelpers.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Text.RegularExpressions; using Cxxi.Generators; @@ -228,16 +229,11 @@ namespace Cxxi #region Function Helpers - public Function FindFunction(string name) + public IEnumerable FindFunction(string name) { - foreach (var module in Library.TranslationUnits) - { - var function = module.FindFunction(name); - if (function != null) - return function; - } - - return null; + return Library.TranslationUnits + .Select(module => module.FindFunction(name)) + .Where(function => function != null); } public void IgnoreFunctionWithName(string name)