Package com.google.dart.engine.element

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


              //
              ExecutableElement[] elementArrayToMerge = new ExecutableElement[subtypesOfAllOtherTypesIndexes.size()];
              for (int i = 0; i < elementArrayToMerge.length; i++) {
                elementArrayToMerge[i] = elements[subtypesOfAllOtherTypesIndexes.get(i)];
              }
              ExecutableElement mergedExecutableElement = computeMergedExecutableElement(elementArrayToMerge);
              resultMap.put(key, mergedExecutableElement);
            }
          }
        } else {
          reportError(
View Full Code Here


   * @param superType the supertype to substitute into the members of the {@link MemberMap}
   * @param map the MemberMap to perform the substitutions on
   */
  private void substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap map) {
    for (int i = 0; i < map.getSize(); i++) {
      ExecutableElement executableElement = map.getValue(i);
      if (executableElement instanceof MethodMember) {
        executableElement = MethodMember.from((MethodMember) executableElement, superType);
        map.setValue(i, executableElement);
      } else if (executableElement instanceof PropertyAccessorMember) {
        executableElement = PropertyAccessorMember.from(
View Full Code Here

          list = new ArrayList<ExecutableElement>(4);
          unionMap.put(key, list);
        }

        // Fetch the entry out of this lookupMap
        ExecutableElement newExecutableElementEntry = lookupMap.getValue(i);

        if (list.isEmpty()) {
          // If the list is empty, just the new value
          list.add(newExecutableElementEntry);
        } else {
          // Otherwise, only add the newExecutableElementEntry if it isn't already in the list, this
          // covers situation where a class inherits two methods (or two getters) that are
          // identical.
          boolean alreadyInList = false;
          boolean isMethod1 = newExecutableElementEntry instanceof MethodElement;
          for (ExecutableElement executableElementInList : list) {
            boolean isMethod2 = executableElementInList instanceof MethodElement;
            if (isMethod1 == isMethod2
                && executableElementInList.getType().equals(newExecutableElementEntry.getType())) {
              alreadyInList = true;
              break;
            }
          }
          if (!alreadyInList) {
View Full Code Here

    //
    // The approach is: we require that each [ExecutableElement] has the
    // same shape: the same number of required, optional positional, and optional named
    // parameters, in the same positions, and with the named parameters in the
    // same order. We compute a type by unioning pointwise.
    ExecutableElement e_0 = elementArrayToMerge[0];
    ParameterElement[] ps_0 = e_0.getParameters();
    ParameterElementImpl[] ps_out = new ParameterElementImpl[ps_0.length];
    for (int j = 0; j < ps_out.length; j++) {
      ps_out[j] = new ParameterElementImpl(ps_0[j].getName(), 0);
      ps_out[j].setSynthetic(true);
      ps_out[j].setType(ps_0[j].getType());
      ps_out[j].setParameterKind(ps_0[j].getParameterKind());
    }
    Type r_out = e_0.getReturnType();

    for (int i = 1; i < elementArrayToMerge.length; i++) {
      ExecutableElement e_i = elementArrayToMerge[i];
      r_out = UnionTypeImpl.union(r_out, e_i.getReturnType());

      ParameterElement[] ps_i = e_i.getParameters();
      // Each function must have the same number of params.
      if (ps_0.length != ps_i.length) {
        return null; // TODO (collinsn): return an element representing [dynamic] here instead.
      } else {
        // Each function must have the same kind of params, with the same names,
View Full Code Here

  public Void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
    // TODO(brianwilkerson) Can we ever resolve the function being invoked?
    Expression expression = node.getFunction();
    if (expression instanceof FunctionExpression) {
      FunctionExpression functionExpression = (FunctionExpression) expression;
      ExecutableElement functionElement = functionExpression.getElement();
      ArgumentList argumentList = node.getArgumentList();
      ParameterElement[] parameters = resolveArgumentsToFunction(
          false,
          argumentList,
          functionElement);
View Full Code Here

  /**
   * @return {@code true} iff current enclosing function is constant constructor declaration.
   */
  private boolean isInConstConstructor() {
    ExecutableElement function = resolver.getEnclosingFunction();
    if (function instanceof ConstructorElement) {
      return ((ConstructorElement) function).isConst();
    }
    return false;
  }
View Full Code Here

   */
  private ExecutableElement lookupGetterOrMethod(Type type, String memberName) {
    type = resolveTypeParameter(type);
    if (type instanceof InterfaceType) {
      InterfaceType interfaceType = (InterfaceType) type;
      ExecutableElement member = interfaceType.lookUpMethod(memberName, definingLibrary);
      if (member != null) {
        return member;
      }
      member = interfaceType.lookUpGetter(memberName, definingLibrary);
      if (member != null) {
View Full Code Here

    if (visitedInterfaces.contains(targetClass)) {
      return null;
    }
    visitedInterfaces.add(targetClass);
    if (includeTargetType) {
      ExecutableElement member = targetType.getMethod(memberName);
      if (member != null) {
        return member;
      }
      member = targetType.getGetter(memberName);
      if (member != null) {
        return member;
      }
    }
    for (InterfaceType interfaceType : targetType.getInterfaces()) {
      ExecutableElement member = lookUpGetterOrMethodInInterfaces(
          interfaceType,
          true,
          memberName,
          visitedInterfaces);
      if (member != null) {
        return member;
      }
    }
    for (InterfaceType mixinType : targetType.getMixins()) {
      ExecutableElement member = lookUpGetterOrMethodInInterfaces(
          mixinType,
          true,
          memberName,
          visitedInterfaces);
      if (member != null) {
View Full Code Here

          labelNode.setStaticElement(labelElement);
        }
      }
    }
    if (labelElement != null) {
      ExecutableElement labelContainer = labelElement.getAncestor(ExecutableElement.class);
      if (labelContainer != resolver.getEnclosingFunction()) {
        resolver.reportErrorForNode(
            CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
            labelNode,
            labelNode.getName());
View Full Code Here

   * @param propertyName the name of the property being accessed
   * @return the element that represents the property
   */
  private ExecutableElement resolveProperty(Expression target, Type targetType,
      SimpleIdentifier propertyName) {
    ExecutableElement memberElement = null;
    if (propertyName.inSetterContext()) {
      memberElement = lookUpSetter(target, targetType, propertyName.getName());
    }
    if (memberElement == null) {
      memberElement = lookUpGetter(target, targetType, propertyName.getName());
View Full Code Here

TOP

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

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.