Package com.google.dart.engine.constant

Examples of com.google.dart.engine.constant.DartObject


            definingClass)) {
          return new ErrorResult(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
        }
        String variableName = argumentCount < 1 ? null : argumentValues[0].getStringValue();
        if (definingClass == typeProvider.getBoolType()) {
          DartObject valueFromEnvironment;
          valueFromEnvironment = declaredVariables.getBool(typeProvider, variableName);
          return computeValueFromEnvironment(
              valueFromEnvironment,
              new DartObjectImpl(typeProvider.getBoolType(), BoolState.FALSE_STATE),
              namedArgumentValues);
        } else if (definingClass == typeProvider.getIntType()) {
          DartObject valueFromEnvironment;
          valueFromEnvironment = declaredVariables.getInt(typeProvider, variableName);
          return computeValueFromEnvironment(
              valueFromEnvironment,
              new DartObjectImpl(typeProvider.getNullType(), NullState.NULL_STATE),
              namedArgumentValues);
        } else if (definingClass == typeProvider.getStringType()) {
          DartObject valueFromEnvironment;
          valueFromEnvironment = declaredVariables.getString(typeProvider, variableName);
          return computeValueFromEnvironment(
              valueFromEnvironment,
              new DartObjectImpl(typeProvider.getNullType(), NullState.NULL_STATE),
              namedArgumentValues);
View Full Code Here


        }
        if (keyResult instanceof ValidResult) {
          reportErrorIfFromDeferredLibrary(
              key,
              CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY);
          DartObject value = ((ValidResult) keyResult).getValue();
          if (keys.contains(value)) {
            invalidKeys.add(key);
          } else {
            keys.add(value);
          }
          Type type = value.getType();
          if (implementsEqualsWhenNotAllowed(type)) {
            errorReporter.reportErrorForNode(
                CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
                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 {
            keys.add(value);
          }
View Full Code Here

            CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION);
        if (caseResult instanceof ValidResult) {
          reportErrorIfFromDeferredLibrary(
              expression,
              CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY);
          DartObject value = ((ValidResult) caseResult).getValue();
          if (firstType == null) {
            firstType = value.getType();
          } else {
            Type nType = value.getType();
            if (!firstType.equals(nType)) {
              errorReporter.reportErrorForNode(
                  CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
                  expression,
                  expression.toSource(),
View Full Code Here

TOP

Related Classes of com.google.dart.engine.constant.DartObject

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.