| Index: pkg/compiler/lib/src/compile_time_constants.dart
|
| diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
|
| index 630ca9d70b1f1717fb80835e09c3b717316d2854..9d2d6db06c64b18b3f30a3fbb16895835ab93273 100644
|
| --- a/pkg/compiler/lib/src/compile_time_constants.dart
|
| +++ b/pkg/compiler/lib/src/compile_time_constants.dart
|
| @@ -252,7 +252,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
|
| checkType &&
|
| expression != null &&
|
| element.isField) {
|
| - DartType elementType = element.type;
|
| + ResolutionDartType elementType = element.type;
|
| ConstantValue value = getConstantValue(expression);
|
| if (elementType.isMalformed && !value.isNull) {
|
| if (isConst) {
|
| @@ -272,7 +272,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
|
| expression = null;
|
| }
|
| } else {
|
| - DartType constantType = value.getType(commonElements);
|
| + ResolutionDartType constantType = value.getType(commonElements);
|
| if (!constantSystem.isSubtype(
|
| compiler.types, constantType, elementType)) {
|
| if (isConst) {
|
| @@ -470,7 +470,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| argumentExpressions.add(argument.expression);
|
| argumentValues.add(argument.value);
|
| }
|
| - DartType type = elements.getType(node);
|
| + ResolutionDartType type = elements.getType(node);
|
| return new AstConstant(
|
| context,
|
| node,
|
| @@ -508,7 +508,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| valueExpressions.add(value.expression);
|
| map[key.value] = value.value;
|
| }
|
| - InterfaceType type = elements.getType(node);
|
| + ResolutionInterfaceType type = elements.getType(node);
|
| return new AstConstant(
|
| context,
|
| node,
|
| @@ -594,7 +594,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| }
|
|
|
| AstConstant visitLiteralSymbol(LiteralSymbol node) {
|
| - InterfaceType type = commonElements.symbolType;
|
| + ResolutionInterfaceType type = commonElements.symbolType;
|
| String text = node.slowNameString;
|
| List<AstConstant> arguments = <AstConstant>[
|
| new AstConstant(context, node, new StringConstantExpression(text),
|
| @@ -608,7 +608,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| context, node, new SymbolConstantExpression(text), constant.value);
|
| }
|
|
|
| - ConstantValue makeTypeConstant(DartType elementType) {
|
| + ConstantValue makeTypeConstant(ResolutionDartType elementType) {
|
| return constantSystem.createType(compiler, elementType);
|
| }
|
|
|
| @@ -624,7 +624,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| Element element = elements[node];
|
| if (Elements.isClass(element) || Elements.isTypedef(element)) {
|
| TypeDeclarationElement typeDeclarationElement = element;
|
| - DartType type = typeDeclarationElement.rawType;
|
| + ResolutionDartType type = typeDeclarationElement.rawType;
|
| return new AstConstant(element, node, new TypeConstantExpression(type),
|
| makeTypeConstant(type));
|
| }
|
| @@ -660,7 +660,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| }
|
| } else if (Elements.isClass(element) || Elements.isTypedef(element)) {
|
| assert(elements.isTypeLiteral(send));
|
| - DartType elementType = elements.getTypeLiteralType(send);
|
| + ResolutionDartType elementType = elements.getTypeLiteralType(send);
|
| result = new AstConstant(
|
| context,
|
| send,
|
| @@ -810,7 +810,8 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| if (condition == null || condition.isError) {
|
| return condition;
|
| } else if (!condition.value.isBool) {
|
| - DartType conditionType = condition.value.getType(commonElements);
|
| + ResolutionDartType conditionType =
|
| + condition.value.getType(commonElements);
|
| if (isEvaluatingConstant) {
|
| reporter.reportErrorMessage(node.condition, MessageKind.NOT_ASSIGNABLE,
|
| {'fromType': conditionType, 'toType': commonElements.boolType});
|
| @@ -897,16 +898,20 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| message: MessageKind.DEFERRED_COMPILE_TIME_CONSTANT_CONSTRUCTION);
|
| }
|
|
|
| - InterfaceType type = elements.getType(node);
|
| + ResolutionInterfaceType type = elements.getType(node);
|
| CallStructure callStructure = elements.getSelector(send).callStructure;
|
|
|
| return createConstructorInvocation(node, type, constructor, callStructure,
|
| arguments: node.send.arguments);
|
| }
|
|
|
| - AstConstant createConstructorInvocation(Node node, InterfaceType type,
|
| - ConstructorElement constructor, CallStructure callStructure,
|
| - {Link<Node> arguments, List<AstConstant> normalizedArguments}) {
|
| + AstConstant createConstructorInvocation(
|
| + Node node,
|
| + ResolutionInterfaceType type,
|
| + ConstructorElement constructor,
|
| + CallStructure callStructure,
|
| + {Link<Node> arguments,
|
| + List<AstConstant> normalizedArguments}) {
|
| // TODO(ahe): This is nasty: we must eagerly analyze the
|
| // constructor to ensure the redirectionTarget has been computed
|
| // correctly. Find a way to avoid this.
|
| @@ -917,7 +922,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| compiler.resolver.resolveRedirectionChain(constructor, node);
|
|
|
| bool isInvalid = false;
|
| - InterfaceType constructedType = type;
|
| + ResolutionInterfaceType constructedType = type;
|
| ConstructorElement implementation;
|
| if (constructor.isRedirectingFactory) {
|
| if (constructor.isEffectiveTargetMalformed) {
|
| @@ -994,7 +999,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
|
|
| AstConstant createFromEnvironmentConstant(
|
| Node node,
|
| - InterfaceType type,
|
| + ResolutionInterfaceType type,
|
| ConstructorElement constructor,
|
| CallStructure callStructure,
|
| List<AstConstant> normalizedArguments,
|
| @@ -1008,7 +1013,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| }
|
|
|
| if (!firstArgument.isString) {
|
| - DartType type = defaultValue.getType(commonElements);
|
| + ResolutionDartType type = defaultValue.getType(commonElements);
|
| return reportNotCompileTimeConstant(
|
| normalizedArguments[0].node,
|
| MessageKind.NOT_ASSIGNABLE,
|
| @@ -1017,7 +1022,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
|
|
| if (constructor.isIntFromEnvironmentConstructor &&
|
| !(defaultValue.isNull || defaultValue.isInt)) {
|
| - DartType type = defaultValue.getType(commonElements);
|
| + ResolutionDartType type = defaultValue.getType(commonElements);
|
| return reportNotCompileTimeConstant(
|
| normalizedArguments[1].node,
|
| MessageKind.NOT_ASSIGNABLE,
|
| @@ -1026,7 +1031,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
|
|
| if (constructor.isBoolFromEnvironmentConstructor &&
|
| !(defaultValue.isNull || defaultValue.isBool)) {
|
| - DartType type = defaultValue.getType(commonElements);
|
| + ResolutionDartType type = defaultValue.getType(commonElements);
|
| return reportNotCompileTimeConstant(
|
| normalizedArguments[1].node,
|
| MessageKind.NOT_ASSIGNABLE,
|
| @@ -1035,7 +1040,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
|
|
| if (constructor.isStringFromEnvironmentConstructor &&
|
| !(defaultValue.isNull || defaultValue.isString)) {
|
| - DartType type = defaultValue.getType(commonElements);
|
| + ResolutionDartType type = defaultValue.getType(commonElements);
|
| return reportNotCompileTimeConstant(
|
| normalizedArguments[1].node,
|
| MessageKind.NOT_ASSIGNABLE,
|
| @@ -1092,9 +1097,9 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| ConstantCompilerBase handler,
|
| Element context,
|
| Node node,
|
| - InterfaceType type,
|
| + ResolutionInterfaceType type,
|
| ConstructorElement constructor,
|
| - InterfaceType constructedType,
|
| + ResolutionInterfaceType constructedType,
|
| ConstructorElement target,
|
| CallStructure callStructure,
|
| List<AstConstant> concreteArguments,
|
| @@ -1163,7 +1168,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
|
| }
|
|
|
| class ConstructorEvaluator extends CompileTimeConstantEvaluator {
|
| - final InterfaceType constructedType;
|
| + final ResolutionInterfaceType constructedType;
|
| final ConstructorElement constructor;
|
| final Map<Element, AstConstant> definitions;
|
| final Map<Element, AstConstant> fieldValues;
|
| @@ -1175,7 +1180,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
|
| * Invariant: [constructor] must be an implementation element.
|
| */
|
| ConstructorEvaluator(
|
| - InterfaceType this.constructedType,
|
| + ResolutionInterfaceType this.constructedType,
|
| ConstructorElement constructor,
|
| ConstantCompiler handler,
|
| Compiler compiler)
|
| @@ -1208,8 +1213,9 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
|
|
|
| void potentiallyCheckType(TypedElement element, AstConstant constant) {
|
| if (compiler.options.enableTypeAssertions) {
|
| - DartType elementType = element.type.substByContext(constructedType);
|
| - DartType constantType = constant.value.getType(commonElements);
|
| + ResolutionDartType elementType =
|
| + element.type.substByContext(constructedType);
|
| + ResolutionDartType constantType = constant.value.getType(commonElements);
|
| if (!constantSystem.isSubtype(
|
| compiler.types, constantType, elementType)) {
|
| reporter.withCurrentElement(constant.element, () {
|
| @@ -1250,7 +1256,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
|
|
|
| void evaluateSuperOrRedirectSend(List<AstConstant> compiledArguments,
|
| CallStructure callStructure, ConstructorElement targetConstructor) {
|
| - InterfaceType type =
|
| + ResolutionInterfaceType type =
|
| constructedType.asInstanceOf(targetConstructor.enclosingClass);
|
| if (compiler.serialization.isDeserialized(targetConstructor)) {
|
| List<ConstantExpression> arguments =
|
|
|