Package com.google.dart.engine.element

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


   * @return the constant value of the static constant
   */
  private Object getConstantValue(Element element) {
    // TODO(brianwilkerson) Implement this
    if (element instanceof FieldElement) {
      FieldElement field = (FieldElement) element;
      if (field.isStatic() && field.isConst()) {
        //field.getConstantValue();
      }
//    } else if (element instanceof VariableElement) {
//      VariableElement variable = (VariableElement) element;
//      if (variable.isStatic() && variable.isConst()) {
View Full Code Here


        // property name (use complete node range)
        if (isNameCoveredByLiteral(property, node)) {
          return property;
        }
        // field name (use complete node range, including @, => and <=>)
        FieldElement field = property.getField();
        if (field != null) {
          int fieldOffset = property.getFieldNameOffset();
          int fieldEnd = fieldOffset + field.getName().length();
          if (node.getOffset() <= fieldOffset && fieldEnd < node.getEnd()) {
            return field;
          }
        }
      }
View Full Code Here

            kind = AngularPropertyKind.TWO_WAY;
          }
          // add property
          if (kind != null) {
            SimpleStringLiteral nameLiteral = getOnlySimpleStringLiteralArgument(annotation);
            FieldElement field = getOnlyFieldElement(fieldDeclaration);
            if (nameLiteral != null && field != null) {
              AngularPropertyElementImpl property = new AngularPropertyElementImpl(
                  nameLiteral.getValue(),
                  nameLiteral.getValueOffset());
              property.setField(field);
View Full Code Here

            fieldNameOffset,
            fieldName.length(),
            fieldName);
        continue;
      }
      FieldElement field = (FieldElement) setter.getVariable();
      // add property
      AngularPropertyElementImpl property = new AngularPropertyElementImpl(name, nameOffset);
      property.setField(field);
      property.setPropertyKind(kind);
      property.setFieldNameOffset(fieldNameOffset);
View Full Code Here

    NormalFormalParameter normalParameter = node.getParameter();
    SimpleIdentifier parameterName = normalParameter.getIdentifier();
    ParameterElementImpl parameter;
    if (normalParameter instanceof FieldFormalParameter) {
      parameter = new DefaultFieldFormalParameterElementImpl(parameterName);
      FieldElement field = fieldMap == null ? null : fieldMap.get(parameterName.getName());
      if (field != null) {
        ((DefaultFieldFormalParameterElementImpl) parameter).setField(field);
      }
    } else {
      parameter = new DefaultParameterElementImpl(parameterName);
View Full Code Here

  @Override
  public Void visitFieldFormalParameter(FieldFormalParameter node) {
    if (!(node.getParent() instanceof DefaultFormalParameter)) {
      SimpleIdentifier parameterName = node.getIdentifier();
      FieldElement field = fieldMap == null ? null : fieldMap.get(parameterName.getName());
      FieldFormalParameterElementImpl parameter = new FieldFormalParameterElementImpl(parameterName);
      parameter.setConst(node.isConst());
      parameter.setFinal(node.isFinal());
      parameter.setParameterKind(node.getKind());
      if (field != null) {
View Full Code Here

   */
  private void buildFieldMap(FieldElement[] fields) {
    fieldMap = new HashMap<String, FieldElement>();
    int count = fields.length;
    for (int i = 0; i < count; i++) {
      FieldElement field = fields[i];
      fieldMap.put(field.getName(), field);
    }
  }
View Full Code Here

  /**
   * Index {@link FieldElement} references from {@link AngularPropertyElement}s.
   */
  private void indexProperties(AngularPropertyElement[] properties) {
    for (AngularPropertyElement property : properties) {
      FieldElement field = property.getField();
      if (field != null) {
        int offset = property.getFieldNameOffset();
        if (offset == -1) {
          continue;
        }
        int length = field.getName().length();
        Location location = new Location(property, offset, length);
        // getter reference
        if (property.getPropertyKind().callsGetter()) {
          PropertyAccessorElement getter = field.getGetter();
          if (getter != null) {
            store.recordRelationship(getter, IndexConstants.IS_REFERENCED_BY_QUALIFIED, location);
          }
        }
        // setter reference
        if (property.getPropertyKind().callsSetter()) {
          PropertyAccessorElement setter = field.getSetter();
          if (setter != null) {
            store.recordRelationship(setter, IndexConstants.IS_REFERENCED_BY_QUALIFIED, location);
          }
        }
      }
View Full Code Here

    } else if (element instanceof FieldElement) {
      location = getLocationWithInitializerType(node, location);
      recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
    } else if (element instanceof FieldFormalParameterElement) {
      FieldFormalParameterElement fieldParameter = (FieldFormalParameterElement) element;
      FieldElement field = fieldParameter.getField();
      recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, location);
    } else if (element instanceof PrefixElement) {
      recordImportElementReferenceWithPrefix(node);
    } else if (element instanceof PropertyAccessorElement || element instanceof MethodElement) {
      location = getLocationWithTypeAssignedToField(node, element, location);
View Full Code Here

          argumentValue = constantVisitor.getNull();
        }
      }
      if (argumentValue != null) {
        if (parameter.isInitializingFormal()) {
          FieldElement field = ((FieldFormalParameterElement) parameter).getField();
          if (field != null) {
            String fieldName = field.getName();
            fieldMap.put(fieldName, argumentValue);
          }
        } else {
          String name = parameter.getName();
          parameterMap.put(name, argumentValue);
View Full Code Here

TOP

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

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.