/// <summary> /// Tries to convert the function to concurrent statements. /// </summary> /// <param name="func">function to convert</param> /// <param name="statements">out parameter to receive a list of concurrent statements</param> /// <returns><c>true</c> if conversion was successful, <c>false</c> if function does not match the concurrent /// statements pattern.</returns> public static bool TryAsConcurrentStatements(this Function func, out List <ConcurrentStatement> statements) { statements = null; if (func.InputVariables.Any() || func.OutputVariables.Any()) { return(false); } var xform = new ConcurrentStatementExtractor(func.Body); xform.Run(); if (!xform.Success) { return(false); } statements = xform.Statements; return(true); }
/// <summary> /// Tries to convert the function to concurrent statements. /// </summary> /// <param name="func">function to convert</param> /// <param name="statements">out parameter to receive a list of concurrent statements</param> /// <returns><c>true</c> if conversion was successful, <c>false</c> if function does not match the concurrent /// statements pattern.</returns> public static bool TryAsConcurrentStatements(this Function func, out List<ConcurrentStatement> statements) { statements = null; if (func.InputVariables.Any() || func.OutputVariables.Any()) return false; var xform = new ConcurrentStatementExtractor(func.Body); xform.Run(); if (!xform.Success) return false; statements = xform.Statements; return true; }