Package com.google.dart.engine.element

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


  @Override
  public LibraryElement[] getExportedLibraries() {
    HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(exports.length);
    for (ExportElement element : exports) {
      LibraryElement library = element.getExportedLibrary();
      if (library != null) {
        libraries.add(library);
      }
    }
    return libraries.toArray(new LibraryElement[libraries.size()]);
View Full Code Here


  @Override
  public LibraryElement[] getImportedLibraries() {
    HashSet<LibraryElement> libraries = new HashSet<LibraryElement>(imports.length);
    for (ImportElement element : imports) {
      LibraryElement library = element.getImportedLibrary();
      if (library != null) {
        libraries.add(library);
      }
    }
    return libraries.toArray(new LibraryElement[libraries.size()]);
View Full Code Here

    if (!visibleLibraries.add(this)) {
      return;
    }
    // add imported libraries
    for (ImportElement importElement : imports) {
      LibraryElement importedLibrary = importElement.getImportedLibrary();
      if (importedLibrary != null) {
        ((LibraryElementImpl) importedLibrary).addVisibleLibraries(visibleLibraries, true);
      }
    }
    // add exported libraries
    if (includeExports) {
      for (ExportElement exportElement : exports) {
        LibraryElement exportedLibrary = exportElement.getExportedLibrary();
        if (exportedLibrary != null) {
          ((LibraryElementImpl) exportedLibrary).addVisibleLibraries(visibleLibraries, true);
        }
      }
    }
View Full Code Here

      if (asyncSource == null) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Could not create a source for dart:async");
        return VoidTypeImpl.getInstance();
      }
      LibraryElement asyncElement = context.computeLibraryElement(asyncSource);
      if (asyncElement == null) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Could not build the element model for dart:async");
        return VoidTypeImpl.getInstance();
      }
      ClassElement futureElement = asyncElement.getType("Future");
      if (futureElement == null) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Could not find type Future in dart:async");
        return VoidTypeImpl.getInstance();
      }
View Full Code Here

  private boolean isOrImportsBrowserLibrary() {
    List<LibraryElement> visited = new ArrayList<LibraryElement>(10);
    Source htmlLibSource = context.getSourceFactory().forUri(DartSdk.DART_HTML);
    visited.add(this);
    for (int index = 0; index < visited.size(); index++) {
      LibraryElement library = visited.get(index);
      Source source = library.getDefiningCompilationUnit().getSource();
      if (source.equals(htmlLibSource)) {
        return true;
      }
      for (LibraryElement importedLibrary : library.getImportedLibraries()) {
        if (!visited.contains(importedLibrary)) {
          visited.add(importedLibrary);
        }
      }
      for (LibraryElement exportedLibrary : library.getExportedLibraries()) {
        if (!visited.contains(exportedLibrary)) {
          visited.add(exportedLibrary);
        }
      }
    }
View Full Code Here

  /**
   * Checks if the given {@link Element} is a part of the Angular library.
   */
  private boolean isAngularLibraryElement(Element element) {
    LibraryElement library = element.getLibrary();
    return library != null && library.getName() != null && library.getName().startsWith("angular");
  }
View Full Code Here

  public void generateUnusedImportHints(ErrorReporter errorReporter) {
    for (ImportDirective unusedImport : unusedImports) {
      // Check that the import isn't dart:core
      ImportElement importElement = unusedImport.getElement();
      if (importElement != null) {
        LibraryElement libraryElement = importElement.getImportedLibrary();
        if (libraryElement != null && libraryElement.isDartCore()) {
          continue;
        }
      }
      errorReporter.reportErrorForNode(HintCode.UNUSED_IMPORT, unusedImport.getUri());
    }
View Full Code Here

    if (inDefiningCompilationUnit) {
      NodeList<Directive> directives = node.getDirectives();
      for (Directive directive : directives) {
        if (directive instanceof ImportDirective) {
          ImportDirective importDirective = (ImportDirective) directive;
          LibraryElement libraryElement = importDirective.getUriElement();
          if (libraryElement != null) {
            unusedImports.add(importDirective);
            //
            // Initialize prefixElementMap
            //
View Full Code Here

      // Identifiers that aren't a prefix element and whose enclosing element isn't a
      // CompilationUnit are ignored- this covers the case the identifier is a relative-reference,
      // a reference to an identifier not imported by this library.
      return null;
    }
    LibraryElement containingLibrary = element.getLibrary();
    if (containingLibrary == null) {
      return null;
    }

    // If the element is declared in the current library, return.
View Full Code Here

        errorReporter.reportErrorForNode(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, node);
      }
      return true;
    }
    Element rhsElement = rhsType.getElement();
    LibraryElement libraryElement = rhsElement != null ? rhsElement.getLibrary() : null;
    if (libraryElement != null && libraryElement.isDartCore()) {
      // if x is Object or null is Null
      if (rhsType.isObject()
          || (expression instanceof NullLiteral && rhsNameStr.equals(NULL_TYPE_NAME))) {
        if (node.getNotOperator() == null) {
          // the is case
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.