Package com.google.dart.engine.ast

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


  }

  @Override
  public Void visitSimpleFormalParameter(SimpleFormalParameter node) {
    if (!(node.getParent() instanceof DefaultFormalParameter)) {
      SimpleIdentifier parameterName = node.getIdentifier();
      ParameterElementImpl parameter = new ParameterElementImpl(parameterName);
      parameter.setConst(node.isConst());
      parameter.setFinal(node.isFinal());
      parameter.setParameterKind(node.getKind());
      setParameterVisibleRange(node, parameter);

      currentHolder.addParameter(parameter);
      parameterName.setStaticElement(parameter);
    }
    return super.visitSimpleFormalParameter(node);
  }
View Full Code Here


    Expression expression = parseDartExpression(resolver, attribute);
    // if not identifier, then not a top-level model, delay until "apply"
    if (!(expression instanceof SimpleIdentifier)) {
      return;
    }
    SimpleIdentifier identifier = (SimpleIdentifier) expression;
    // define variable Element
    InterfaceType type = resolver.getTypeProvider().getStringType();
    LocalVariableElementImpl element = resolver.createLocalVariableFromIdentifier(type, identifier);
    resolver.defineTopVariable(element);
    // remember expression
    identifier.setStaticElement(element);
    identifier.setStaticType(type);
    setExpression(attribute, identifier);
  }
View Full Code Here

    // Build the enum constants.
    //
    NodeList<EnumConstantDeclaration> constants = node.getConstants();
    int constantCount = constants.size();
    for (int i = 0; i < constantCount; i++) {
      SimpleIdentifier constantName = constants.get(i).getName();
      FieldElementImpl constantField = new ConstFieldElementImpl(constantName);
      constantField.setStatic(true);
      constantField.setConst(true);
      constantField.setType(enumType);
      //
      // Create a value for the constant.
      //
      HashMap<String, DartObjectImpl> fieldMap = new HashMap<String, DartObjectImpl>();
      fieldMap.put(indexFieldName, new DartObjectImpl(intType, new IntState(BigInteger.valueOf(i))));
      DartObjectImpl value = new DartObjectImpl(enumType, new GenericState(fieldMap));
      constantField.setEvaluationResult(new ValidResult(value));
      fields.add(constantField);
      getters.add(createGetter(constantField));
      constantName.setStaticElement(constantField);
    }
    //
    // Finish building the enum.
    //
    enumElement.setFields(fields.toArray(new FieldElement[fields.size()]));
View Full Code Here

//    Element element = node.getStaticElement();
//    if (isStringLength(element)) {
//      EvaluationResultImpl target = node.getPrefix().accept(this);
//      return target.stringLength(typeProvider, node);
//    }
    SimpleIdentifier prefixNode = node.getPrefix();
    Element prefixElement = prefixNode.getStaticElement();
    if (!(prefixElement instanceof PrefixElement)) {
      EvaluationResultImpl prefixResult = prefixNode.accept(this);
      if (!(prefixResult instanceof ValidResult)) {
        return error(node, null);
      }
    }
    // validate prefixed identifier
View Full Code Here

  @Override
  public void visitExpression(Expression expression) {
    // Formatter
    if (expression instanceof SimpleIdentifier) {
      SimpleIdentifier identifier = (SimpleIdentifier) expression;
      Element element = identifier.getBestElement();
      if (element instanceof AngularElement) {
        store.recordRelationship(
            element,
            IndexConstants.ANGULAR_REFERENCE,
            createLocationForIdentifier(identifier));
View Full Code Here

          lhsSpec.length());
      return;
    }
    // parse item name
    Expression varExpression = resolver.parseDartExpression(lhsSpec, 0, lhsSpec.length(), lhsOffset);
    SimpleIdentifier varName = (SimpleIdentifier) varExpression;
    // parse iterable
    AngularExpression iterableExpr = resolver.parseAngularExpression(
        iterableSpec,
        0,
        iterableSpec.length(),
        iterableOffset);
    // resolve as: for (name in iterable) {}
    DeclaredIdentifier loopVariable = new DeclaredIdentifier(null, null, null, null, varName);
    Block loopBody = new Block(null, new ArrayList<Statement>(), null);
    ForEachStatement loopStatement = new ForEachStatement(
        null,
        null,
        null,
        loopVariable,
        null,
        iterableExpr.getExpression(),
        null,
        loopBody);
    new ElementBuilder(new ElementHolder()).visitDeclaredIdentifier(loopVariable);
    resolver.resolveNode(loopStatement);
    // define item variable
    Type itemType = varName.getBestType();
    {
      LocalVariableElementImpl variable = (LocalVariableElementImpl) varName.getStaticElement();
      variable.setType(itemType);
      resolver.defineVariable(variable);
    }
    // resolve formatters
    resolveFormatters(resolver, iterableExpr, itemType);
View Full Code Here

      List<Expression> expressions = Lists.newArrayList();
      List<MapLiteralEntry> entries = ((MapLiteral) arg).getEntries();
      for (MapLiteralEntry mapEntry : entries) {
        Expression keyExpr = mapEntry.getKey();
        if (keyExpr instanceof SimpleIdentifier) {
          SimpleIdentifier propertyNode = (SimpleIdentifier) keyExpr;
          resolvePropertyNode(resolver, expressions, itemType, propertyNode);
        }
      }
      // set resolved sub-expressions
      argument.setSubExpressions(expressions.toArray(new Expression[expressions.size()]));
View Full Code Here

        return;
      }
      // resolve property name
      arg = resolver.parseDartExpression(exprSource, 0, exprSource.length(), argOffset);
      if (arg instanceof SimpleIdentifier) {
        SimpleIdentifier propertyNode = (SimpleIdentifier) arg;
        resolvePropertyNode(resolver, expressions, itemType, propertyNode);
      }
    }
  }
View Full Code Here

   * Resolves sequence of formatters.
   */
  private void resolveFormatters(AngularHtmlUnitResolver resolver,
      AngularExpression angularExpression, Type itemType) {
    for (AngularFormatterNode formatter : angularExpression.getFormatters()) {
      SimpleIdentifier formatterNameNode = formatter.getName();
      String formatterName = formatterNameNode.getName();
      // resolve formatter name
      formatterNameNode.setStaticElement(resolver.findAngularElement(formatterName));
      // resolve formatter arguments
      resolveFormatterArguments(resolver, itemType, formatterName, formatter.getArguments());
    }
  }
View Full Code Here

        return false;
      }
    }
    Identifier className = typeName.getName();
    // report as named or default constructor absence
    SimpleIdentifier name = constructorName.getName();
    if (name != null) {
      errorReporter.reportErrorForNode(
          CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
          name,
          className,
View Full Code Here

TOP

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

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.