コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 public static bool PreEvaluateAll(IEnumerable <QsNamespace> syntaxTree,
                                   out IEnumerable <QsNamespace> evaluated, Action <Exception> onException = null)
 {
     try { evaluated = PreEvalution.All(syntaxTree); }
     catch (Exception ex)
     {
         onException?.Invoke(ex);
         evaluated = syntaxTree;
         return(false);
     }
     return(true);
 }
コード例 #2
0
 /// <summary>
 /// Pre-evaluates as much of the classical computations as possible in the given compilation.
 /// Any thrown exception is logged using the given onException action and are silently ignored if onException is not specified or null.
 /// Returns true if the transformation succeeded without throwing an exception, and false otherwise.
 /// Throws an ArgumentNullException (that is not logged or ignored) if the given compilation is null.
 /// </summary>
 public static bool PreEvaluateAll(this QsCompilation compilation, out QsCompilation evaluated, Action <Exception> onException = null)
 {
     if (compilation == null)
     {
         throw new ArgumentNullException(nameof(compilation));
     }
     try { evaluated = PreEvalution.All(compilation); }
     catch (Exception ex)
     {
         onException?.Invoke(ex);
         evaluated = compilation;
         return(false);
     }
     return(true);
 }