Package com.google.dart.engine.internal.task

Examples of com.google.dart.engine.internal.task.AnalysisTask


      // Ensure that all of the data needed to resolve them has been computed.
      //
      ensureImportsAndExports();
      if (taskData != null) {
        // At least one imported library needs to be resolved before the target library.
        AnalysisTask task = taskData.getTask();
        if (task instanceof ResolveDartLibraryTask) {
          workManager.addFirst(
              ((ResolveDartLibraryTask) task).getLibrarySource(),
              SourcePriority.LIBRARY);
        }
View Full Code Here


  public AnalysisResult performAnalysisTask() {
    if (TRACE_PERFORM_TASK) {
      System.out.println("----------------------------------------");
    }
    long getStart = System.currentTimeMillis();
    AnalysisTask task = getNextAnalysisTask();
    long getEnd = System.currentTimeMillis();
    if (task == null && validateCacheConsistency()) {
      task = getNextAnalysisTask();
    }
    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);
    }
    long performStart = System.currentTimeMillis();
    try {
      task.perform(resultRecorder);
    } catch (ObsoleteSourceAnalysisException exception) {
      AnalysisEngine.getInstance().getLogger().logInformation(
          "Could not perform analysis task: " + taskDescription,
          exception);
    } catch (AnalysisException exception) {
      if (!(exception.getCause() instanceof IOException)) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Internal error while performing the task: " + task,
            exception);
      }
    }
    long performEnd = System.currentTimeMillis();
    ChangeNotice[] notices = getChangeNotices(false);
    int noticeCount = notices.length;
    for (int i = 0; i < noticeCount; i++) {
      ChangeNotice notice = notices[i];
      Source source = notice.getSource();
      // TODO(brianwilkerson) Figure out whether the compilation unit is always resolved, or whether
      // we need to decide whether to invoke the "parsed" or "resolved" method. This might be better
      // done when recording task results in order to reduce the chance of errors.
//      if (notice.getCompilationUnit() != null) {
//        notifyResolvedDart(source, notice.getCompilationUnit());
//      } else if (notice.getHtmlUnit() != null) {
//        notifyResolvedHtml(source, notice.getHtmlUnit());
//      }
      notifyErrors(source, notice.getErrors(), notice.getLineInfo());
    }
    return new AnalysisResult(notices, getEnd - getStart, task.getClass().getName(), performEnd
        - performStart);
  }
View Full Code Here

      boolean hasBlockedTask = false;
      //
      // Look for incremental analysis
      //
      if (incrementalAnalysisCache != null && incrementalAnalysisCache.hasWork()) {
        AnalysisTask task = new IncrementalAnalysisTask(this, incrementalAnalysisCache);
        incrementalAnalysisCache = null;
        return task;
      }
      //
      // Look for a priority source that needs to be analyzed.
      //
      int priorityCount = priorityOrder.length;
      for (int i = 0; i < priorityCount; i++) {
        Source source = priorityOrder[i];
        TaskData taskData = getNextAnalysisTaskForSource(
            source,
            cache.get(source),
            true,
            hintsEnabled);
        AnalysisTask task = taskData.getTask();
        if (task != null) {
          return task;
        } else if (taskData.isBlocked()) {
          hasBlockedTask = true;
        }
      }
      if (neededForResolution != null) {
        ArrayList<Source> sourcesToRemove = new ArrayList<Source>();
        for (Source source : neededForResolution) {
          SourceEntry sourceEntry = cache.get(source);
          if (sourceEntry instanceof DartEntry) {
            DartEntry dartEntry = (DartEntry) sourceEntry;
            if (!dartEntry.hasResolvableCompilationUnit()) {
              if (dartEntry.getState(DartEntry.PARSED_UNIT) == CacheState.ERROR) {
                sourcesToRemove.add(source);
              } else {
                TaskData taskData = createParseDartTask(source, dartEntry);
                AnalysisTask task = taskData.getTask();
                if (task != null) {
                  return task;
                } else if (taskData.isBlocked()) {
                  hasBlockedTask = true;
                }
              }
            }
          }
        }
        int count = sourcesToRemove.size();
        for (int i = 0; i < count; i++) {
          neededForResolution.remove(sourcesToRemove.get(i));
        }
      }
      //
      // Look for a non-priority source that needs to be analyzed.
      //
      ArrayList<Source> sourcesToRemove = new ArrayList<Source>();
      WorkManager.WorkIterator sources = workManager.iterator();
      try {
        while (sources.hasNext()) {
          Source source = sources.next();
          TaskData taskData = getNextAnalysisTaskForSource(
              source,
              cache.get(source),
              false,
              hintsEnabled);
          AnalysisTask task = taskData.getTask();
          if (task != null) {
            return task;
          } else if (taskData.isBlocked()) {
            hasBlockedTask = true;
          } else {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.task.AnalysisTask

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.