Package com.google.dart.engine.utilities.io

Examples of com.google.dart.engine.utilities.io.PrintStringWriter


    if (task == null) {
      return new AnalysisResult(getChangeNotices(true), getEnd - getStart, null, -1L);
    }
    String taskDescription = task.toString();
    if (!reportedLoop && !recentTasks.add(taskDescription)) {
      @SuppressWarnings("resource")
      PrintStringWriter writer = new PrintStringWriter();
      writer.print("Performing repeated task: ");
      writer.println(taskDescription);
      for (String description : recentTasks) {
        writer.print("  ");
        writer.println(description);
      }
      logInformation(writer.toString());
    }
    notifyAboutToPerformTask(taskDescription);
    if (TRACE_PERFORM_TASK) {
      System.out.println(taskDescription);
    }
View Full Code Here


              notice.setCompilationUnit(unit);
              notice.setErrors(dartCopy.getAllErrors(), lineInfo);
            }
          }
        } else {
          @SuppressWarnings("resource")
          PrintStringWriter writer = new PrintStringWriter();
          writer.println("Library resolution results discarded for");
          for (ResolvableLibrary library : resolvedLibraries) {
            for (Source source : library.getCompilationUnitSources()) {
              DartEntry dartEntry = getReadableDartEntry(source);
              if (dartEntry != null) {
                long resultTime = library.getModificationTime(source);
                writer.println("  " + debuggingString(source) + "; sourceTime = "
                    + getModificationStamp(source) + ", resultTime = " + resultTime
                    + ", cacheTime = " + dartEntry.getModificationTime());
                DartEntryImpl dartCopy = dartEntry.getWritableCopy();
                if (thrownException == null || resultTime >= 0L) {
                  //
                  // The analysis was performed on out-of-date sources. Mark the cache so that the
                  // sources will be re-analyzed using the up-to-date sources.
                  //
                  dartCopy.recordResolutionNotInProcess();
                } else {
                  //
                  // We could not determine whether the sources were up-to-date or out-of-date. Mark
                  // the cache so that we won't attempt to re-analyze the sources until there's a
                  // good chance that we'll be able to do so without error.
                  //
                  dartCopy.recordResolutionError(thrownException);
                  cache.remove(source);
                }
                cache.put(source, dartCopy);
                if (source.equals(unitSource)) {
                  unitEntry = dartCopy;
                }
              } else {
                writer.println("  " + debuggingString(source) + "; sourceTime = "
                    + getModificationStamp(source) + ", no entry");
              }
            }
          }
          logInformation(writer.toString());
        }
      }
    }
    if (thrownException != null) {
      throw thrownException;
View Full Code Here

              notice.setCompilationUnit(unit);
              notice.setErrors(dartCopy.getAllErrors(), lineInfo);
            }
          }
        } else {
          @SuppressWarnings("resource")
          PrintStringWriter writer = new PrintStringWriter();
          writer.println("Library resolution results discarded for");
          for (Library library : resolvedLibraries) {
            for (Source source : library.getCompilationUnitSources()) {
              DartEntry dartEntry = getReadableDartEntry(source);
              if (dartEntry != null) {
                long resultTime = library.getModificationTime(source);
                writer.println("  " + debuggingString(source) + "; sourceTime = "
                    + getModificationStamp(source) + ", resultTime = " + resultTime
                    + ", cacheTime = " + dartEntry.getModificationTime());
                DartEntryImpl dartCopy = dartEntry.getWritableCopy();
                if (thrownException == null || resultTime >= 0L) {
                  //
                  // The analysis was performed on out-of-date sources. Mark the cache so that the
                  // sources will be re-analyzed using the up-to-date sources.
                  //
                  dartCopy.recordResolutionNotInProcess();
                } else {
                  //
                  // We could not determine whether the sources were up-to-date or out-of-date. Mark
                  // the cache so that we won't attempt to re-analyze the sources until there's a
                  // good chance that we'll be able to do so without error.
                  //
                  dartCopy.recordResolutionError(thrownException);
                  cache.remove(source);
                }
                cache.put(source, dartCopy);
                if (source.equals(unitSource)) {
                  unitEntry = dartCopy;
                }
              } else {
                writer.println("  " + debuggingString(source) + "; sourceTime = "
                    + getModificationStamp(source) + ", no entry");
              }
            }
          }
          logInformation(writer.toString());
        }
      }
    }
    if (thrownException != null) {
      throw thrownException;
View Full Code Here

        sourceChanged(changedSources.get(i));
      }
    }
    long consistencyCheckEnd = System.nanoTime();
    if (changedSources.size() > 0 || missingSources.size() > 0) {
      @SuppressWarnings("resource")
      PrintStringWriter writer = new PrintStringWriter();
      writer.print("Consistency check took ");
      writer.print((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
      writer.println(" ms and found");
      writer.print("  ");
      writer.print(changedSources.size());
      writer.println(" inconsistent entries");
      writer.print("  ");
      writer.print(missingSources.size());
      writer.println(" missing sources");
      for (Source source : missingSources) {
        writer.print("    ");
        writer.println(source.getFullName());
      }
      logInformation(writer.toString());
    }
    return changedSources.size() > 0;
  }
View Full Code Here

   * string will not be valid source primarily in the case where the node itself is not well-formed.
   *
   * @return the source code equivalent of this node
   */
  public String toSource() {
    PrintStringWriter writer = new PrintStringWriter();
    accept(new ToSourceVisitor(writer));
    return writer.toString();
  }
View Full Code Here

    this.element = element;
  }

  @Override
  public String toString() {
    PrintStringWriter writer = new PrintStringWriter();
    accept(new ToSourceVisitor(writer));
    return writer.toString();
  }
View Full Code Here

      parameters = enclosingAlias.getParameters();
    }
    ParameterElement element = parameters == null ? null
        : findIdentifier(parameters, parameterName);
    if (element == null) {
      @SuppressWarnings("resource")
      PrintStringWriter writer = new PrintStringWriter();
      writer.println("Invalid state found in the Analysis Engine:");
      writer.println("DeclarationResolver.getElementForParameter() is visiting a parameter that "
          + "does not appear to be in a method or function.");
      writer.println("Ancestors:");
      AstNode parent = node.getParent();
      while (parent != null) {
        writer.println(parent.getClass().getName());
        writer.println("---------");
        parent = parent.getParent();
      }
      AnalysisEngine.getInstance().getLogger().logError(writer.toString(), new AnalysisException());
    }
    return element;
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.utilities.io.PrintStringWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.