Package com.google.dart.engine.source

Examples of com.google.dart.engine.source.Source


   */
  private Source[] getUnanalyzedSources() {
    Set<Source> sources = Sets.newHashSet();
    for (IndexOperation operation : queue.getOperations()) {
      if (operation instanceof IndexUnitOperation) {
        Source source = ((IndexUnitOperation) operation).getSource();
        sources.add(source);
      }
    }
    return sources.toArray(new Source[sources.size()]);
  }
View Full Code Here


     */
    public Source next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      Source source = workQueues[queueIndex].get(index);
      advance();
      return source;
    }
View Full Code Here

    CompilationUnitElement definingUnitElement = libraryElement.getDefiningCompilationUnit();
    if (definingUnitElement == null) {
      return false;
    }
    // prepare sources
    Source library = definingUnitElement.getSource();
    Source unit = unitElement.getSource();
    // special handling for the defining library unit
    if (unit.equals(library)) {
      // prepare new parts
      Set<Source> newParts = Sets.newHashSet();
      for (CompilationUnitElement part : libraryElement.getParts()) {
        newParts.add(part.getSource());
      }
      // prepare old parts
      Map<Source, Set<Source>> libraryToUnits = contextToLibraryToUnits.get(context);
      if (libraryToUnits == null) {
        libraryToUnits = Maps.newHashMap();
        contextToLibraryToUnits.put(context, libraryToUnits);
      }
      Set<Source> oldParts = libraryToUnits.get(library);
      // check if some parts are not in the library now
      if (oldParts != null) {
        Set<Source> noParts = Sets.difference(oldParts, newParts);
        for (Source noPart : noParts) {
          removeLocations(context, library, noPart);
        }
      }
      // remember new parts
      libraryToUnits.put(library, newParts);
    }
    // remember library/unit relations
    recordUnitInLibrary(context, library, unit);
    recordLibraryWithUnit(context, library, unit);
    sources.add(library);
    sources.add(unit);
    // prepare node
    String libraryName = library.getFullName();
    String unitName = unit.getFullName();
    int libraryNameIndex = stringCodec.encode(libraryName);
    int unitNameIndex = stringCodec.encode(unitName);
    currentNodeName = libraryNameIndex + "_" + unitNameIndex + ".index";
    currentNodeNameId = stringCodec.encode(currentNodeName);
    currentNode = nodeManager.newNode(context);
View Full Code Here

    // may be already disposed in other thread
    if (context.isDisposed()) {
      return false;
    }
    // remove locations
    Source source = htmlElement.getSource();
    removeLocations(context, null, source);
    // remember library/unit relations
    recordUnitInLibrary(context, null, source);
    // prepare node
    String sourceName = source.getFullName();
    int sourceNameIndex = stringCodec.encode(sourceName);
    currentNodeName = sourceNameIndex + ".index";
    currentNodeNameId = stringCodec.encode(currentNodeName);
    currentNode = nodeManager.newNode(context);
    return true;
View Full Code Here

      if (operation instanceof ClearOperation) {
        queryOperations.clear();
        nonQueryOperations.clear();
      }
      if (operation instanceof RemoveSourceOperation) {
        Source source = ((RemoveSourceOperation) operation).getSource();
        removeForSource(source, nonQueryOperations);
        removeForSource(source, queryOperations);
      }
      if (operation.isQuery()) {
        queryOperations.add(operation);
View Full Code Here

    return libraryElement;
  }

  @Override
  protected String getTaskDescription() {
    Source librarySource = libraryElement.getSource();
    if (librarySource == null) {
      return "generate Dart hints for library without source";
    }
    return "generate Dart hints for " + librarySource.getFullName();
  }
View Full Code Here

    // Store the results.
    //
    hintMap = new HashMap<Source, TimestampedData<AnalysisError[]>>(unitCount);
    for (int i = 0; i < unitCount; i++) {
      long modificationTime = units[i].getModificationTime();
      Source source = units[i].getData().getElement().getSource();
      AnalysisError[] errors = errorListener.getErrorsForSource(source);
      hintMap.put(source, new TimestampedData<AnalysisError[]>(modificationTime, errors));
    }
  }
View Full Code Here

        }
        if (scriptAttribute != null) {
          try {
            URI uri = new URI(null, null, scriptAttribute.getText(), null);
            String fileName = uri.getPath();
            Source librarySource = getContext().getSourceFactory().resolveUri(source, fileName);
            if (getContext().exists(librarySource)) {
              libraries.add(librarySource);
            }
          } catch (URISyntaxException e) {
            // ignored - invalid URI reported during resolution phase
View Full Code Here

    // Report change to the per-library state.
    //
    HashMap<Source, ResolutionState> oldStateMap = new HashMap<Source, ResolutionState>();
    ResolutionState state = ((DartEntryImpl) oldEntry).resolutionState;
    while (state != null) {
      Source librarySource = state.librarySource;
      if (librarySource != null) {
        oldStateMap.put(librarySource, state);
      }
      state = state.nextState;
    }
    state = resolutionState;
    while (state != null) {
      Source librarySource = state.librarySource;
      if (librarySource != null) {
        ResolutionState oldState = oldStateMap.remove(librarySource);
        if (oldState == null) {
          if (needsSeparator) {
            builder.append("; ");
          }
          builder.append("added resolution for ");
          builder.append(librarySource.getFullName());
          needsSeparator = true;
        } else {
          needsSeparator = oldState.writeDiffOn(builder, needsSeparator, (DartEntry) oldEntry);
        }
      }
      state = state.nextState;
    }
    for (Source librarySource : oldStateMap.keySet()) {
      if (needsSeparator) {
        builder.append("; ");
      }
      builder.append("removed resolution for ");
      builder.append(librarySource.getFullName());
      needsSeparator = true;
    }
    return needsSeparator;
  }
View Full Code Here

    // TODO(scheglov) Maybe check if more than one "script".
    for (XmlTagNode child : elementNode.getTagNodes()) {
      if (child instanceof HtmlScriptTagNode) {
        HtmlScriptElement scriptElement = ((HtmlScriptTagNode) child).getScriptElement();
        if (scriptElement instanceof ExternalHtmlScriptElement) {
          Source scriptSource = ((ExternalHtmlScriptElement) scriptElement).getScriptSource();
          if (scriptSource != null) {
            return context.getLibraryElement(scriptSource);
          }
        }
      }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.source.Source

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.