Package com.google.dart.engine.ast

Examples of com.google.dart.engine.ast.CompilationUnit


      String oldContents, String newContents, int offset, int oldLength, int newLength,
      SourceEntry sourceEntry) {

    // Determine the cache resolved unit
    Source librarySource = null;
    CompilationUnit unit = null;
    if (sourceEntry instanceof DartEntryImpl) {
      DartEntryImpl dartEntry = (DartEntryImpl) sourceEntry;
      Source[] librarySources = dartEntry.getLibrariesContaining();
      if (librarySources.length == 1) {
        librarySource = librarySources[0];
View Full Code Here


   * @param node the node (not {@code null})
   * @return the source or {@code null} if it could not be determined
   */
  private Source getSource(AstNode node) {
    Source source = null;
    CompilationUnit unit = node.getAncestor(CompilationUnit.class);
    if (unit != null) {
      CompilationUnitElement element = unit.getElement();
      if (element != null) {
        source = element.getSource();
      }
    }
    return source;
View Full Code Here

  /**
   * Return the resolved {@link AstNode} of the given type enclosing {@link #getNameOffset()}.
   */
  protected <T extends AstNode> T getNodeMatching(Class<T> clazz) throws AnalysisException {
    CompilationUnit unit = getUnit();
    if (unit == null) {
      return null;
    }
    int offset = getNameOffset();
    AstNode node = new NodeLocator(offset).searchWithin(unit);
View Full Code Here

    }
    Source source = element.getSource();
    if (source == null) {
      return null;
    }
    CompilationUnit unit = parseCompilationUnit(source);
    if (unit == null) {
      return null;
    }
    NodeLocator locator = new NodeLocator(element.getNameOffset());
    AstNode nameNode = locator.searchWithin(unit);
View Full Code Here

        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());
View Full Code Here

          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);
View Full Code Here

          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) {
View Full Code Here

      //
      // If not, compute the information. Unless the modification date of the source continues to
      // change, this loop will eventually terminate.
      //
      LibraryElement library = computeLibraryElement(librarySource);
      CompilationUnit unit = resolveCompilationUnit(unitSource, library);
      if (unit == null) {
        throw new AnalysisException("Could not resolve compilation unit "
            + unitSource.getFullName() + " in " + librarySource.getFullName());
      }
      dartEntry = (DartEntry) new GenerateDartErrorsTask(
View Full Code Here

      Source librarySource, DartEntry libraryEntry) {
    if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != CacheState.VALID
        || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID) {
      return createResolveDartLibraryTask(librarySource, libraryEntry);
    }
    CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource);
    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);
View Full Code Here

   * @throws AnalysisException if the results could not be recorded
   */
  private DartEntry recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task)
      throws AnalysisException {
    synchronized (cacheLock) {
      CompilationUnit unit = task.getCompilationUnit();
      if (unit != null) {
        ChangeNoticeImpl notice = getNotice(task.getSource());
        notice.setCompilationUnit(unit);
        incrementalAnalysisCache = IncrementalAnalysisCache.cacheResult(task.getCache(), unit);
      }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.ast.CompilationUnit

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.