Package com.google.dart.engine.ast

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


        return false;
      }

      private boolean isContext(Expression target) {
        if (target instanceof PrefixedIdentifier) {
          PrefixedIdentifier prefixed = (PrefixedIdentifier) target;
          SimpleIdentifier prefix = prefixed.getPrefix();
          SimpleIdentifier identifier = prefixed.getIdentifier();
          return ObjectUtilities.equals(identifier.getName(), "context") && isScope(prefix);
        }
        return false;
      }
View Full Code Here


          parent = propertyAccess.getParent();
        }
      }
      // obj.field = x;
      if (parent instanceof PrefixedIdentifier) {
        PrefixedIdentifier prefixedIdentifier = (PrefixedIdentifier) parent;
        if (prefixedIdentifier.getIdentifier() == node) {
          node = prefixedIdentifier;
          parent = prefixedIdentifier.getParent();
        }
      }
    }
    // OK, remember the type
    if (parent instanceof AssignmentExpression) {
View Full Code Here

    CompilationUnit unit = prefixNode.getAncestor(CompilationUnit.class);
    LibraryElement libraryElement = unit.getElement().getLibrary();
    // prepare used element
    Element usedElement = null;
    if (parent instanceof PrefixedIdentifier) {
      PrefixedIdentifier prefixed = (PrefixedIdentifier) parent;
      if (prefixed.getPrefix() == prefixNode) {
        usedElement = prefixed.getStaticElement();
        info.periodEnd = prefixed.getPeriod().getEnd();
      }
    }
    if (parent instanceof MethodInvocation) {
      MethodInvocation invocation = (MethodInvocation) parent;
      if (invocation.getTarget() == prefixNode) {
View Full Code Here

      if (access.getPropertyName() == node && access.getRealTarget() != null) {
        return false;
      }
    }
    if (parent instanceof PrefixedIdentifier) {
      PrefixedIdentifier prefixed = (PrefixedIdentifier) parent;
      if (prefixed.getIdentifier() == node) {
        return false;
      }
    }
    // report problem
    if (isInStaticMethod) {
View Full Code Here

      AstNode parent = node.getParent();
      if (typeName instanceof PrefixedIdentifier && parent instanceof ConstructorName
          && argumentList == null) {
        ConstructorName name = (ConstructorName) parent;
        if (name.getName() == null) {
          PrefixedIdentifier prefixedIdentifier = (PrefixedIdentifier) typeName;
          SimpleIdentifier prefix = prefixedIdentifier.getPrefix();
          element = getNameScope().lookup(prefix, getDefiningLibrary());
          if (element instanceof PrefixElement) {
            if (parent.getParent() instanceof InstanceCreationExpression
                && ((InstanceCreationExpression) parent.getParent()).isConst()) {
              // If, if this is a const expression, then generate a
              // CompileTimeErrorCode.CONST_WITH_NON_TYPE error.
              reportErrorForNode(
                  CompileTimeErrorCode.CONST_WITH_NON_TYPE,
                  prefixedIdentifier.getIdentifier(),
                  prefixedIdentifier.getIdentifier().getName());
            } else {
              // Else, if this expression is a new expression, report a NEW_WITH_NON_TYPE warning.
              reportErrorForNode(
                  StaticWarningCode.NEW_WITH_NON_TYPE,
                  prefixedIdentifier.getIdentifier(),
                  prefixedIdentifier.getIdentifier().getName());
            }
            setElement(prefix, element);
            return null;
          } else if (element != null) {
            //
            // Rewrite the constructor name. The parser, when it sees a constructor named "a.b",
            // cannot tell whether "a" is a prefix and "b" is a class name, or whether "a" is a
            // class name and "b" is a constructor name. It arbitrarily chooses the former, but
            // in this case was wrong.
            //
            name.setName(prefixedIdentifier.getIdentifier());
            name.setPeriod(prefixedIdentifier.getPeriod());
            node.setName(prefix);
            typeName = prefix;
          }
        }
      }
View Full Code Here

  private void setElement(Identifier typeName, Element element) {
    if (element != null) {
      if (typeName instanceof SimpleIdentifier) {
        ((SimpleIdentifier) typeName).setStaticElement(element);
      } else if (typeName instanceof PrefixedIdentifier) {
        PrefixedIdentifier identifier = (PrefixedIdentifier) typeName;
        identifier.getIdentifier().setStaticElement(element);
        SimpleIdentifier prefix = identifier.getPrefix();
        Element prefixElement = getNameScope().lookup(prefix, getDefiningLibrary());
        if (prefixElement != null) {
          prefix.setStaticElement(prefixElement);
        }
      }
View Full Code Here

            // TODO(brianwilkerson) Report this error.
          }
        }
      }
    } else if (identifier instanceof PrefixedIdentifier) {
      PrefixedIdentifier prefixedIdentifier = (PrefixedIdentifier) identifier;
      SimpleIdentifier prefix = prefixedIdentifier.getPrefix();
      SimpleIdentifier name = prefixedIdentifier.getIdentifier();
      Element element = resolveSimpleIdentifier(prefix);
      if (element == null) {
//        resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, prefix, prefix.getName());
      } else {
        if (element instanceof PrefixElement) {
View Full Code Here

    SimpleIdentifier nameNode1;
    SimpleIdentifier nameNode2;
    {
      Identifier annName = annotation.getName();
      if (annName instanceof PrefixedIdentifier) {
        PrefixedIdentifier prefixed = (PrefixedIdentifier) annName;
        nameNode1 = prefixed.getPrefix();
        nameNode2 = prefixed.getIdentifier();
      } else {
        nameNode1 = (SimpleIdentifier) annName;
        nameNode2 = null;
      }
    }
View Full Code Here

TOP

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

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.