Package com.google.dart.engine.internal.constant

Examples of com.google.dart.engine.internal.constant.ConstantVisitor


    this.source = source;
    this.typeProvider = typeProvider;
  }

  public EvaluationResult evaluate(Expression expression) {
    EvaluationResultImpl result = expression.accept(new ConstantVisitor(typeProvider));
    if (result instanceof ValidResult) {
      return EvaluationResult.forValue(((ValidResult) result).getValue());
    }
    ArrayList<AnalysisError> errors = new ArrayList<AnalysisError>();
    for (ErrorResult.ErrorData data : ((ErrorResult) result).getErrorData()) {
View Full Code Here


                key,
                type.getDisplayName());
          }
        }
      } else {
        EvaluationResultImpl result = key.accept(new ConstantVisitor(typeProvider));
        if (result instanceof ValidResult) {
          DartObject value = ((ValidResult) result).getValue();
          if (keys.contains(value)) {
            invalidKeys.add(key);
          } else {
View Full Code Here

   * @param expression the expression to be validated
   * @param errorCode the error code to be used if the expression is not a compile time constant
   * @return the value of the compile time constant
   */
  private EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) {
    EvaluationResultImpl result = expression.accept(new ConstantVisitor(typeProvider));
    reportErrors(result, errorCode);
    return result;
  }
View Full Code Here

        FieldDeclaration fieldDeclaration = (FieldDeclaration) member;
        if (!fieldDeclaration.isStatic()) {
          for (VariableDeclaration variableDeclaration : fieldDeclaration.getFields().getVariables()) {
            Expression initializer = variableDeclaration.getInitializer();
            if (initializer != null) {
              EvaluationResultImpl result = initializer.accept(new ConstantVisitor(typeProvider));
              if (!(result instanceof ValidResult)) {
                errorReporter.reportErrorForNode(
                    CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
                    errorSite,
                    variableDeclaration.getName().getName());
View Full Code Here

   *          considered as a valid potentially constant expressions
   * @param expression the expression to validate
   */
  private void validateInitializerExpression(final ParameterElement[] parameterElements,
      Expression expression) {
    EvaluationResultImpl result = expression.accept(new ConstantVisitor(typeProvider) {
      @Override
      public EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) {
        Element element = node.getStaticElement();
        for (ParameterElement parameterElement : parameterElements) {
          if (parameterElement == element && parameterElement != null) {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.constant.ConstantVisitor

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.