private void WholeTreeVerificationAnalysis(SyntaxTreeAnalysisContext treeContext)
        {
            lock (_mutex)
            {
                if (treeContext.Tree.GetText().ToString().Length < 10)
                {
                    return;
                }
                var translationProcess = TranslationProcess.CreateFromSyntaxTree(treeContext.Tree);
                var result             = translationProcess.Execute();

                /*
                 * Do not double-report errors. These are already reported by WholeTreeTranslationAnalysis.
                 *
                 * foreach (var diagnostic in result.Errors)
                 * {
                 *
                 *  if (diagnostic.Node != null)
                 *  {
                 *      treeContext.ReportDiagnostic(Diagnostic.Create(
                 *          rules[diagnostic.Diagnostic.ErrorCode], diagnostic.Node.GetLocation(),
                 *          diagnostic.DiagnosticArguments)
                 *      );
                 *  }
                 *  else
                 *  {
                 *      treeContext.ReportDiagnostic(Diagnostic.Create(
                 *          rules[diagnostic.Diagnostic.ErrorCode], null, diagnostic.DiagnosticArguments)
                 *      );
                 *  }
                 * }
                 */
                if (!result.WasTranslationSuccessful)
                {
                    return;                                   // translation errors are handled by the other method
                }
                if (result.Silvernode.ToString().Trim() == "")
                {
                    return;
                }
                var verifier           = new CarbonNailgunBackend();
                var verificationResult = verifier.Verify(result.Silvernode);
                foreach (var diagnostic in verificationResult.Errors)
                {
                    if (diagnostic.Node != null)
                    {
                        treeContext.ReportDiagnostic(Diagnostic.Create(
                                                         rules[diagnostic.Diagnostic.ErrorCode], diagnostic.Node.GetLocation(),
                                                         diagnostic.DiagnosticArguments)
                                                     );
                    }
                    else
                    {
                        treeContext.ReportDiagnostic(Diagnostic.Create(
                                                         rules[diagnostic.Diagnostic.ErrorCode], null, diagnostic.DiagnosticArguments)
                                                     );
                    }
                }
            }
        }
 private void WholeTreeTranslationAnalysis(SyntaxTreeAnalysisContext treeContext)
 {
     lock (_mutex)
     {
         var translationProcess = TranslationProcess.CreateFromSyntaxTree(treeContext.Tree);
         var result             = translationProcess.Execute();
         foreach (var diagnostic in result.Errors)
         {
             if (diagnostic.Node != null)
             {
                 treeContext.ReportDiagnostic(Diagnostic.Create(
                                                  rules[diagnostic.Diagnostic.ErrorCode], diagnostic.Node.GetLocation(),
                                                  diagnostic.DiagnosticArguments)
                                              );
             }
             else
             {
                 treeContext.ReportDiagnostic(Diagnostic.Create(
                                                  rules[diagnostic.Diagnostic.ErrorCode], null, diagnostic.DiagnosticArguments)
                                              );
             }
         }
     }
 }