Package com.google.dart.engine.element

Examples of com.google.dart.engine.element.LibraryElement


    // Update the resolution
    TypeProvider typeProvider = getTypeProvider();
    if (updatedUnit != null && typeProvider != null) {
      CompilationUnitElement element = updatedUnit.getElement();
      if (element != null) {
        LibraryElement library = element.getLibrary();
        if (library != null) {
          IncrementalResolver resolver = new IncrementalResolver(
              library,
              cache.getSource(),
              typeProvider,
View Full Code Here


    }
    // validate unit
    if (unitElement == null) {
      return false;
    }
    LibraryElement libraryElement = unitElement.getLibrary();
    if (libraryElement == null) {
      return false;
    }
    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) {
View Full Code Here

      if (function.getName().equals("identical")) {
        NodeList<Expression> arguments = node.getArgumentList().getArguments();
        if (arguments.size() == 2) {
          Element enclosingElement = function.getEnclosingElement();
          if (enclosingElement instanceof CompilationUnitElement) {
            LibraryElement library = ((CompilationUnitElement) enclosingElement).getLibrary();
            if (library.isDartCore()) {
              EvaluationResultImpl leftArgument = arguments.get(0).accept(this);
              EvaluationResultImpl rightArgument = arguments.get(1).accept(this);
              return leftArgument.equalEqual(typeProvider, node, rightArgument);
            }
          }
View Full Code Here

  /**
   * Returns the {@link PolymerTagDartElement} that corresponds to the Polymer custom tag declared
   * by the given {@link XmlTagNode}.
   */
  private PolymerTagDartElementImpl findTagDartElement() {
    LibraryElement dartLibraryElement = getDartUnitElement();
    if (dartLibraryElement == null) {
      return null;
    }
    return findTagDartElement_inLibrary(dartLibraryElement);
  }
View Full Code Here

    this.libraries = libraries;
  }

  @Override
  public boolean encloses(Element element) {
    LibraryElement elementLibrary = element.getAncestor(LibraryElement.class);
    return ArrayUtils.contains(libraries, elementLibrary);
  }
View Full Code Here

  @Override
  public Void visitExportDirective(ExportDirective node) {
    ExportElement exportElement = node.getElement();
    if (exportElement != null) {
      LibraryElement exportedLibrary = exportElement.getExportedLibrary();
      checkForAmbiguousExport(node, exportElement, exportedLibrary);
      checkForExportDuplicateLibraryName(node, exportElement, exportedLibrary);
      checkForExportInternalLibrary(node, exportElement);
    }
    return super.visitExportDirective(node);
View Full Code Here

    if (exportedLibrary == null) {
      return false;
    }
    String name = exportedLibrary.getName();
    // check if there is other exported library with the same name
    LibraryElement prevLibrary = nameToExportElement.get(name);
    if (prevLibrary != null) {
      if (!prevLibrary.equals(exportedLibrary)) {
        errorReporter.reportErrorForNode(
            StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME,
            node,
            prevLibrary.getDefiningCompilationUnit().getDisplayName(),
            exportedLibrary.getDefiningCompilationUnit().getDisplayName(),
            name);
        return true;
      }
    } else {
View Full Code Here

   * @see CompileTimeErrorCode#IMPORT_DUPLICATED_LIBRARY_NAME
   */
  private boolean checkForImportDuplicateLibraryName(ImportDirective node,
      ImportElement importElement) {
    // prepare imported library
    LibraryElement nodeLibrary = importElement.getImportedLibrary();
    if (nodeLibrary == null) {
      return false;
    }
    String name = nodeLibrary.getName();
    // check if there is other imported library with the same name
    LibraryElement prevLibrary = nameToImportElement.get(name);
    if (prevLibrary != null) {
      if (!prevLibrary.equals(nodeLibrary)) {
        errorReporter.reportErrorForNode(
            StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME,
            node,
            prevLibrary.getDefiningCompilationUnit().getDisplayName(),
            nodeLibrary.getDefiningCompilationUnit().getDisplayName(),
            name);
        return true;
      }
    } else {
View Full Code Here

      InterfaceType superclassType = enclosingClass.getSupertype();
      ClassElement superclassElement = superclassType == null ? null : superclassType.getElement();
      boolean executableElementPrivate = Identifier.isPrivateName(executableElementName);
      while (superclassElement != null && !visitedClasses.contains(superclassElement)) {
        visitedClasses.add(superclassElement);
        LibraryElement superclassLibrary = superclassElement.getLibrary();
        // Check fields.
        FieldElement[] fieldElts = superclassElement.getFields();
        for (FieldElement fieldElt : fieldElts) {
          // We need the same name.
          if (!fieldElt.getName().equals(executableElementName)) {
View Full Code Here

    if (type instanceof InterfaceType) {
      InterfaceType interfaceType = (InterfaceType) type;
      if (interfaceType.getName().equals("Future")) {
        ClassElement element = interfaceType.getElement();
        if (element != null) {
          LibraryElement library = element.getLibrary();
          if (library.getName().equals("dart.async")) {
            return true;
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.element.LibraryElement

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.