Package com.google.dart.engine.element

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


  public boolean isDeferred() {
    Element element = prefix.getStaticElement();
    if (!(element instanceof PrefixElement)) {
      return false;
    }
    PrefixElement prefixElement = (PrefixElement) element;
    ImportElement[] imports = prefixElement.getEnclosingElement().getImportsWithPrefix(
        prefixElement);
    if (imports.length != 1) {
      return false;
    }
    return imports[0].isDeferred();
View Full Code Here


  @Override
  public PrefixElement[] getPrefixes() {
    HashSet<PrefixElement> prefixes = new HashSet<PrefixElement>(imports.length);
    for (ImportElement element : imports) {
      PrefixElement prefix = element.getPrefix();
      if (prefix != null) {
        prefixes.add(prefix);
      }
    }
    return prefixes.toArray(new PrefixElement[prefixes.size()]);
View Full Code Here

            if (importDirective.getAsToken() != null) {
              SimpleIdentifier prefixIdentifier = importDirective.getPrefix();
              if (prefixIdentifier != null) {
                Element element = prefixIdentifier.getStaticElement();
                if (element instanceof PrefixElement) {
                  PrefixElement prefixElementKey = (PrefixElement) element;
                  ArrayList<ImportDirective> list = prefixElementMap.get(prefixElementKey);
                  if (list == null) {
                    list = new ArrayList<ImportDirective>(1);
                    prefixElementMap.put(prefixElementKey, list);
                  }
View Full Code Here

      // required library
      if (!Objects.equal(importElement.getImportedLibrary(), usedLibrary)) {
        continue;
      }
      // required prefix
      PrefixElement prefixElement = importElement.getPrefix();
      if (prefix == null) {
        if (prefixElement != null) {
          continue;
        }
      } else {
        if (prefixElement == null) {
          continue;
        }
        if (!prefix.equals(prefixElement.getName())) {
          continue;
        }
      }
      // no combinators => only possible candidate
      if (importElement.getCombinators().length == 0) {
View Full Code Here

          ImportDirective importDirective = (ImportDirective) directive;
          SimpleIdentifier prefix = importDirective.getPrefix();
          if (prefix != null) {
            Element element = prefix.getStaticElement();
            if (element instanceof PrefixElement) {
              PrefixElement prefixElement = (PrefixElement) element;
              ArrayList<ImportDirective> elements = prefixToDirectivesMap.get(prefixElement);
              if (elements == null) {
                elements = new ArrayList<ImportDirective>();
                prefixToDirectivesMap.put(prefixElement, elements);
              }
View Full Code Here

   * @return the import element whose library has the given source and prefix
   */
  private ImportElement findImport(ImportElement[] imports, Source source, SimpleIdentifier prefix) {
    for (ImportElement element : imports) {
      if (element.getImportedLibrary().getSource().equals(source)) {
        PrefixElement prefixElement = element.getPrefix();
        if (prefix == null) {
          if (prefixElement == null) {
            return element;
          }
        } else {
          if (prefixElement != null && prefix.getName().equals(prefixElement.getDisplayName())) {
            return element;
          }
        }
      }
    }
View Full Code Here

   */
  private Element findImportWithoutPrefix(SimpleIdentifier identifier) {
    Element element = null;
    Scope nameScope = resolver.getNameScope();
    for (ImportElement importElement : definingLibrary.getImports()) {
      PrefixElement prefixElement = importElement.getPrefix();
      if (prefixElement != null) {
        Identifier prefixedIdentifier = new SyntheticIdentifier(prefixElement.getName() + "."
            + identifier.getName());
        Element importedElement = nameScope.lookup(prefixedIdentifier, definingLibrary);
        if (importedElement != null) {
          if (element == null) {
            element = importedElement;
View Full Code Here

   *
   * @param expression the expression representing the deferred import's prefix
   * @return the library that is being imported by the import associated with the prefix
   */
  private LibraryElement getImportedLibrary(Expression expression) {
    PrefixElement prefixElement = (PrefixElement) ((SimpleIdentifier) expression).getStaticElement();
    ImportElement[] imports = prefixElement.getEnclosingElement().getImportsWithPrefix(
        prefixElement);
    return imports[0].getImportedLibrary();
  }
View Full Code Here

    }
    Element element = ((SimpleIdentifier) expression).getStaticElement();
    if (!(element instanceof PrefixElement)) {
      return false;
    }
    PrefixElement prefixElement = (PrefixElement) element;
    ImportElement[] imports = prefixElement.getEnclosingElement().getImportsWithPrefix(
        prefixElement);
    if (imports.length != 1) {
      return false;
    }
    return imports[0].isDeferred();
View Full Code Here

   * @return the import element whose library has the given source and prefix
   */
  private ImportElement findImport(ImportElement[] imports, Source source, SimpleIdentifier prefix) {
    for (ImportElement element : imports) {
      if (element.getImportedLibrary().getSource().equals(source)) {
        PrefixElement prefixElement = element.getPrefix();
        if (prefix == null) {
          if (prefixElement == null) {
            return element;
          }
        } else {
          if (prefixElement != null && prefix.getName().equals(prefixElement.getDisplayName())) {
            return element;
          }
        }
      }
    }
View Full Code Here

TOP

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

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.