Examples of DartEntryImpl


Examples of com.google.dart.engine.internal.cache.DartEntryImpl

          if (dartEntry == null) {
            throw new AnalysisException("A Dart file became a non-Dart file: "
                + source.getFullName());
          }
        }
        DartEntryImpl dartCopy = dartEntry.getWritableCopy();
        if (thrownException == null) {
          LineInfo lineInfo = task.getLineInfo();
          dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
          dartCopy.setValue(DartEntry.TOKEN_STREAM, task.getTokenStream());
          dartCopy.setValue(DartEntry.SCAN_ERRORS, task.getErrors());
          cache.storedAst(source);

          ChangeNoticeImpl notice = getNotice(source);
          notice.setErrors(dartEntry.getAllErrors(), lineInfo);
        } else {
          removeFromParts(source, dartEntry);
          dartCopy.recordScanError(thrownException);
          cache.removedAst(source);
        }
        cache.put(source, dartCopy);
        dartEntry = dartCopy;
      } else {
        logInformation(
            "Scan results discarded for " + debuggingString(source) + "; sourceTime = "
                + sourceTime + ", resultTime = " + resultTime + ", cacheTime = "
                + dartEntry.getModificationTime(),
            thrownException);
        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.recordScanNotInProcess();
          removeFromParts(source, dartEntry);
          dartCopy.invalidateAllInformation();
          dartCopy.setModificationTime(sourceTime);
          cache.removedAst(source);
          workManager.add(source, SourcePriority.UNKNOWN);
        } 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.recordScanError(thrownException);
        }
        cache.put(source, dartCopy);
        dartEntry = dartCopy;
      }
    }
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

        for (int i = 0; i < count; i++) {
          Source source = sourcesToInvalidate.get(i);
          SourceEntry entry = getReadableSourceEntry(source);
          if (entry instanceof DartEntry) {
            DartEntry dartEntry = (DartEntry) entry;
            DartEntryImpl dartCopy = dartEntry.getWritableCopy();
            dartCopy.invalidateAllResolutionInformation(false);
            cache.put(source, dartCopy);
            workManager.add(source, computePriority(dartCopy));
          } else if (entry instanceof HtmlEntry) {
            HtmlEntry htmlEntry = (HtmlEntry) entry;
            HtmlEntryImpl htmlCopy = htmlEntry.getWritableCopy();
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

      if (dartEntry == null) {
        throw new AnalysisException("computeResolvableCompilationUnit for non-Dart: "
            + source.getFullName());
      }
      dartEntry = cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT);
      DartEntryImpl dartCopy = dartEntry.getWritableCopy();
      CompilationUnit unit = dartCopy.getResolvableCompilationUnit();
      if (unit == null) {
        throw new AnalysisException(
            "Internal error: computeResolvableCompilationUnit could not parse "
                + source.getFullName(),
            dartEntry.getException());
      }
      cache.put(source, dartCopy);
      return new ResolvableCompilationUnit(dartCopy.getModificationTime(), unit);
    }
  }
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

              "Could not compute the public namespace for " + library.getSource().getFullName(),
              new AnalysisException("A Dart file became a non-Dart file: " + source.getFullName()));
          return null;
        }
        if (dartEntry.getValue(DartEntry.ELEMENT) == library) {
          DartEntryImpl dartCopy = getReadableDartEntry(source).getWritableCopy();
          dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace);
          cache.put(source, dartCopy);
        }
      }
    }
    return namespace;
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

        //
        // Cache the element in the library's info.
        //
        DartEntry dartEntry = getReadableDartEntry(librarySource);
        if (dartEntry != null) {
          DartEntryImpl dartCopy = dartEntry.getWritableCopy();
          recordElementData(dartCopy, library, library.getSource(), htmlSource);
          dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
          dartCopy.setValue(SourceEntry.LINE_INFO, new LineInfo(new int[] {0}));
          dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS);
          // DartEntry.ELEMENT - set in recordElementData
          dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY);
          dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY);
          dartCopy.setValue(DartEntry.INCLUDED_PARTS, Source.EMPTY_ARRAY);
          // DartEntry.IS_CLIENT - set in recordElementData
          // DartEntry.IS_LAUNCHABLE - set in recordElementData
          dartCopy.setValue(DartEntry.PARSE_ERRORS, AnalysisError.NO_ERRORS);
          dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
          dartCopy.setState(DartEntry.PUBLIC_NAMESPACE, CacheState.FLUSHED);
          dartCopy.setValue(DartEntry.SCAN_ERRORS, AnalysisError.NO_ERRORS);
          dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
          dartCopy.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED);

          dartCopy.setValueInLibrary(
              DartEntry.RESOLUTION_ERRORS,
              librarySource,
              AnalysisError.NO_ERRORS);
          dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, CacheState.FLUSHED);
          dartCopy.setValueInLibrary(
              DartEntry.VERIFICATION_ERRORS,
              librarySource,
              AnalysisError.NO_ERRORS);
          dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, AnalysisError.NO_ERRORS);
          cache.put(librarySource, dartCopy);
        }
      }
    }
  }
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

          unitEntry = getReadableDartEntry(unitSource);
          if (unitEntry == null) {
            throw new AnalysisException("A Dart file became a non-Dart file: "
                + unitSource.getFullName());
          }
          DartEntryImpl dartCopy = unitEntry.getWritableCopy();
          if (thrownException == null) {
            dartCopy.recordResolutionError(new AnalysisException(
                "In recordResolveDartLibraryCycleTaskResults, resolvedLibraries was null and there was no thrown exception"));
          } else {
            dartCopy.recordResolutionError(thrownException);
          }
          cache.put(unitSource, dartCopy);
          cache.remove(unitSource);
          if (thrownException != null) {
            throw thrownException;
          }
          return dartCopy;
        }
        if (allModificationTimesMatch(resolvedLibraries)) {
          Source htmlSource = getSourceFactory().forUri(DartSdk.DART_HTML);
          RecordingErrorListener errorListener = resolver.getErrorListener();
          for (ResolvableLibrary library : resolvedLibraries) {
            Source librarySource = library.getLibrarySource();
            for (Source source : library.getCompilationUnitSources()) {
              CompilationUnit unit = library.getAST(source);
              AnalysisError[] errors = errorListener.getErrorsForSource(source);
              LineInfo lineInfo = getLineInfo(source);
              DartEntryImpl dartCopy = (DartEntryImpl) cache.get(source).getWritableCopy();
              if (thrownException == null) {
                dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
                dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, unit);
                dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, errors);
                if (source.equals(librarySource)) {
                  recordElementData(
                      dartCopy,
                      library.getLibraryElement(),
                      librarySource,
                      htmlSource);
                }
                cache.storedAst(source);
              } else {
                dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException);
                cache.remove(source);
              }
              cache.put(source, dartCopy);
              if (!source.equals(librarySource)) {
                workManager.add(source, SourcePriority.PRIORITY_PART);
              }
              if (source.equals(unitSource)) {
                unitEntry = dartCopy;
              }

              ChangeNoticeImpl notice = getNotice(source);
              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;
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

          unitEntry = getReadableDartEntry(unitSource);
          if (unitEntry == null) {
            throw new AnalysisException("A Dart file became a non-Dart file: "
                + unitSource.getFullName());
          }
          DartEntryImpl dartCopy = unitEntry.getWritableCopy();
          if (thrownException == null) {
            dartCopy.recordResolutionError(new AnalysisException(
                "In recordResolveDartLibraryTaskResults, resolvedLibraries was null and there was no thrown exception"));
          } else {
            dartCopy.recordResolutionError(thrownException);
          }
          cache.put(unitSource, dartCopy);
          cache.remove(unitSource);
          if (thrownException != null) {
            throw thrownException;
          }
          return dartCopy;
        }
        if (allModificationTimesMatch(resolvedLibraries)) {
          Source htmlSource = getSourceFactory().forUri(DartSdk.DART_HTML);
          RecordingErrorListener errorListener = resolver.getErrorListener();
          for (Library library : resolvedLibraries) {
            Source librarySource = library.getLibrarySource();
            for (Source source : library.getCompilationUnitSources()) {
              CompilationUnit unit = library.getAST(source);
              AnalysisError[] errors = errorListener.getErrorsForSource(source);
              LineInfo lineInfo = getLineInfo(source);
              DartEntry dartEntry = (DartEntry) cache.get(source);
              long sourceTime = getModificationStamp(source);
              if (dartEntry.getModificationTime() != sourceTime) {
                // The source has changed without the context being notified. Simulate notification.
                sourceChanged(source);
                dartEntry = getReadableDartEntry(source);
                if (dartEntry == null) {
                  throw new AnalysisException("A Dart file became a non-Dart file: "
                      + source.getFullName());
                }
              }
              DartEntryImpl dartCopy = dartEntry.getWritableCopy();
              if (thrownException == null) {
                dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
                dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
                dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, unit);
                dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, errors);
                if (source.equals(librarySource)) {
                  recordElementData(
                      dartCopy,
                      library.getLibraryElement(),
                      librarySource,
                      htmlSource);
                }
                cache.storedAst(source);
              } else {
                dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException);
                cache.remove(source);
              }
              cache.put(source, dartCopy);
              if (!source.equals(librarySource)) {
                workManager.add(source, SourcePriority.PRIORITY_PART);
              }
              if (source.equals(unitSource)) {
                unitEntry = dartCopy;
              }

              ChangeNoticeImpl notice = getNotice(source);
              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;
View Full Code Here

Examples of com.google.dart.engine.internal.cache.DartEntryImpl

    if (unit == null) {
      AnalysisException exception = new AnalysisException(
          "Entry has VALID state for RESOLVED_UNIT but null value for " + unitSource.getFullName()
              + " in " + librarySource.getFullName());
      AnalysisEngine.getInstance().getLogger().logInformation(exception.getMessage(), exception);
      DartEntryImpl dartCopy = unitEntry.getWritableCopy();
      dartCopy.recordResolutionError(exception);
      cache.put(unitSource, dartCopy);
      return new TaskData(null, false);
    }
    LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
    DartEntryImpl dartCopy = unitEntry.getWritableCopy();
    dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, CacheState.IN_PROCESS);
    cache.put(unitSource, dartCopy);
    return new TaskData(new GenerateDartErrorsTask(
        this,
        unitSource,
        dartCopy.getModificationTime(),
        unit,
        libraryElement), false);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.