Package com.google.dart.engine.ast

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


    ConstantVisitor initializerVisitor = new ConstantVisitor(typeProvider, parameterMap);
    String superName = null;
    NodeList<Expression> superArguments = null;
    for (ConstructorInitializer initializer : initializers) {
      if (initializer instanceof ConstructorFieldInitializer) {
        ConstructorFieldInitializer constructorFieldInitializer = (ConstructorFieldInitializer) initializer;
        Expression initializerExpression = constructorFieldInitializer.getExpression();
        EvaluationResultImpl evaluationResult = initializerExpression.accept(initializerVisitor);
        if (evaluationResult instanceof ValidResult) {
          DartObjectImpl value = ((ValidResult) evaluationResult).getValue();
          String fieldName = constructorFieldInitializer.getFieldName().getName();
          fieldMap.put(fieldName, value);
        }
      } else if (initializer instanceof SuperConstructorInvocation) {
        SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) initializer;
        SimpleIdentifier name = superConstructorInvocation.getConstructorName();
View Full Code Here


   * If the given node is the part of the {@link ConstructorFieldInitializer}, returns location with
   * type of the initializer expression.
   */
  private static Location getLocationWithInitializerType(SimpleIdentifier node, Location location) {
    if (node.getParent() instanceof ConstructorFieldInitializer) {
      ConstructorFieldInitializer initializer = (ConstructorFieldInitializer) node.getParent();
      if (initializer.getFieldName() == node) {
        location = getLocationWithExpressionType(location, initializer.getExpression());
      }
    }
    return location;
  }
View Full Code Here

  private void validateConstructorInitializers(ConstructorDeclaration constructor) {
    ParameterElement[] parameterElements = constructor.getParameters().getParameterElements();
    NodeList<ConstructorInitializer> initializers = constructor.getInitializers();
    for (ConstructorInitializer initializer : initializers) {
      if (initializer instanceof ConstructorFieldInitializer) {
        ConstructorFieldInitializer fieldInitializer = (ConstructorFieldInitializer) initializer;
        validateInitializerExpression(parameterElements, fieldInitializer.getExpression());
      }
      if (initializer instanceof RedirectingConstructorInvocation) {
        RedirectingConstructorInvocation invocation = (RedirectingConstructorInvocation) initializer;
        validateInitializerInvocationArguments(parameterElements, invocation.getArgumentList());
      }
View Full Code Here

    for (ConstructorInitializer constructorInitializer : initializers) {
      if (constructorInitializer instanceof RedirectingConstructorInvocation) {
        return false;
      }
      if (constructorInitializer instanceof ConstructorFieldInitializer) {
        ConstructorFieldInitializer constructorFieldInitializer = (ConstructorFieldInitializer) constructorInitializer;
        SimpleIdentifier fieldName = constructorFieldInitializer.getFieldName();
        Element element = fieldName.getStaticElement();
        if (element instanceof FieldElement) {
          FieldElement fieldElement = (FieldElement) element;
          INIT_STATE state = fieldElementsMap.get(fieldElement);
          if (state == INIT_STATE.NOT_INIT) {
View Full Code Here

TOP

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

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.