| Index: pkg/compiler/lib/src/constants/values.dart
|
| diff --git a/pkg/compiler/lib/src/constants/values.dart b/pkg/compiler/lib/src/constants/values.dart
|
| index 9cf9b4b1712902e16dcdc1e5a3a2cc3bdcfe05bf..36c14ccdbcffb0b331299c8219513fea8938a25c 100644
|
| --- a/pkg/compiler/lib/src/constants/values.dart
|
| +++ b/pkg/compiler/lib/src/constants/values.dart
|
| @@ -8,7 +8,7 @@ import '../common.dart';
|
| import '../core_types.dart';
|
| import '../elements/elements.dart' show Entity;
|
| import '../elements/entities.dart';
|
| -import '../elements/resolution_types.dart';
|
| +import '../elements/types.dart';
|
| import '../tree/dartstring.dart';
|
| import '../util/util.dart' show Hashing;
|
|
|
| @@ -82,7 +82,7 @@ abstract class ConstantValue {
|
| bool get isNegativeInfinity => false;
|
|
|
| // TODO(johnniwinther): Replace with a 'type' getter.
|
| - ResolutionDartType getType(CommonElements types);
|
| + DartType getType(CommonElements types);
|
|
|
| List<ConstantValue> getDependencies();
|
|
|
| @@ -114,7 +114,7 @@ abstract class ConstantValue {
|
| class FunctionConstantValue extends ConstantValue {
|
| final FunctionEntity element;
|
| // TODO(johnniwinther): Should the type be derived from [element].
|
| - final ResolutionFunctionType type;
|
| + final FunctionType type;
|
|
|
| FunctionConstantValue(this.element, this.type);
|
|
|
| @@ -131,7 +131,7 @@ class FunctionConstantValue extends ConstantValue {
|
| return new DartString.literal(element.name);
|
| }
|
|
|
| - ResolutionDartType getType(CommonElements types) => type;
|
| + DartType getType(CommonElements types) => type;
|
|
|
| int get hashCode => (17 * element.hashCode) & 0x7fffffff;
|
|
|
| @@ -189,7 +189,7 @@ class NullConstantValue extends PrimitiveConstantValue {
|
|
|
| get primitiveValue => null;
|
|
|
| - ResolutionDartType getType(CommonElements types) => types.nullType;
|
| + DartType getType(CommonElements types) => types.nullType;
|
|
|
| // The magic constant has no meaning. It is just a random value.
|
| int get hashCode => 785965825;
|
| @@ -261,7 +261,7 @@ class IntConstantValue extends NumConstantValue {
|
|
|
| bool get isOne => primitiveValue == 1;
|
|
|
| - ResolutionDartType getType(CommonElements types) => types.intType;
|
| + DartType getType(CommonElements types) => types.intType;
|
|
|
| // We have to override the equality operator so that ints and doubles are
|
| // treated as separate constants.
|
| @@ -322,7 +322,7 @@ class DoubleConstantValue extends NumConstantValue {
|
|
|
| bool get isNegativeInfinity => primitiveValue == -double.INFINITY;
|
|
|
| - ResolutionDartType getType(CommonElements types) => types.doubleType;
|
| + DartType getType(CommonElements types) => types.doubleType;
|
|
|
| bool operator ==(var other) {
|
| if (other is! DoubleConstantValue) return false;
|
| @@ -359,7 +359,7 @@ abstract class BoolConstantValue extends PrimitiveConstantValue {
|
|
|
| bool get isBool => true;
|
|
|
| - ResolutionDartType getType(CommonElements types) => types.boolType;
|
| + DartType getType(CommonElements types) => types.boolType;
|
|
|
| BoolConstantValue negate();
|
|
|
| @@ -427,7 +427,7 @@ class StringConstantValue extends PrimitiveConstantValue {
|
|
|
| bool get isString => true;
|
|
|
| - ResolutionDartType getType(CommonElements types) => types.stringType;
|
| + DartType getType(CommonElements types) => types.stringType;
|
|
|
| bool operator ==(var other) {
|
| if (identical(this, other)) return true;
|
| @@ -452,13 +452,13 @@ class StringConstantValue extends PrimitiveConstantValue {
|
| }
|
|
|
| abstract class ObjectConstantValue extends ConstantValue {
|
| - final ResolutionInterfaceType type;
|
| + final InterfaceType type;
|
|
|
| ObjectConstantValue(this.type);
|
|
|
| bool get isObject => true;
|
|
|
| - ResolutionDartType getType(CommonElements types) => type;
|
| + DartType getType(CommonElements types) => type;
|
|
|
| void _unparseTypeArguments(StringBuffer sb) {
|
| if (!type.treatAsRaw) {
|
| @@ -471,10 +471,9 @@ abstract class ObjectConstantValue extends ConstantValue {
|
|
|
| class TypeConstantValue extends ObjectConstantValue {
|
| /// The user type that this constant represents.
|
| - final ResolutionDartType representedType;
|
| + final DartType representedType;
|
|
|
| - TypeConstantValue(this.representedType, ResolutionInterfaceType type)
|
| - : super(type);
|
| + TypeConstantValue(this.representedType, InterfaceType type) : super(type);
|
|
|
| bool get isType => true;
|
|
|
| @@ -500,7 +499,7 @@ class ListConstantValue extends ObjectConstantValue {
|
| final List<ConstantValue> entries;
|
| final int hashCode;
|
|
|
| - ListConstantValue(ResolutionInterfaceType type, List<ConstantValue> entries)
|
| + ListConstantValue(InterfaceType type, List<ConstantValue> entries)
|
| : this.entries = entries,
|
| hashCode = Hashing.listHash(entries, Hashing.objectHash(type)),
|
| super(type);
|
| @@ -560,8 +559,8 @@ class MapConstantValue extends ObjectConstantValue {
|
| final int hashCode;
|
| Map<ConstantValue, ConstantValue> _lookupMap;
|
|
|
| - MapConstantValue(ResolutionInterfaceType type, List<ConstantValue> keys,
|
| - List<ConstantValue> values)
|
| + MapConstantValue(
|
| + InterfaceType type, List<ConstantValue> keys, List<ConstantValue> values)
|
| : this.keys = keys,
|
| this.values = values,
|
| this.hashCode = Hashing.listHash(
|
| @@ -636,20 +635,19 @@ class MapConstantValue extends ObjectConstantValue {
|
| }
|
|
|
| class InterceptorConstantValue extends ConstantValue {
|
| - /// The type for which this interceptor holds the methods. The constant
|
| - /// is a dispatch table for this type.
|
| - final ResolutionDartType dispatchedType;
|
| + /// The class for which this interceptor holds the methods. The constant
|
| + /// is a dispatch table for this class.
|
| + final ClassEntity cls;
|
|
|
| - InterceptorConstantValue(this.dispatchedType);
|
| + InterceptorConstantValue(this.cls);
|
|
|
| bool get isInterceptor => true;
|
|
|
| bool operator ==(other) {
|
| - return other is InterceptorConstantValue &&
|
| - dispatchedType == other.dispatchedType;
|
| + return other is InterceptorConstantValue && cls == other.cls;
|
| }
|
|
|
| - int get hashCode => dispatchedType.hashCode * 43;
|
| + int get hashCode => cls.hashCode * 43;
|
|
|
| List<ConstantValue> getDependencies() => const <ConstantValue>[];
|
|
|
| @@ -657,17 +655,16 @@ class InterceptorConstantValue extends ConstantValue {
|
| return visitor.visitInterceptor(this, arg);
|
| }
|
|
|
| - ResolutionDartType getType(CommonElements types) =>
|
| - const ResolutionDynamicType();
|
| + DartType getType(CommonElements types) => types.dynamicType;
|
|
|
| ConstantValueKind get kind => ConstantValueKind.INTERCEPTOR;
|
|
|
| String toDartText() {
|
| - return 'interceptor($dispatchedType)';
|
| + return 'interceptor($cls)';
|
| }
|
|
|
| String toStructuredText() {
|
| - return 'InterceptorConstant(${dispatchedType.getStringAsDeclared("o")})';
|
| + return 'InterceptorConstant(${cls.name})';
|
| }
|
| }
|
|
|
| @@ -691,8 +688,7 @@ class SyntheticConstantValue extends ConstantValue {
|
| return visitor.visitSynthetic(this, arg);
|
| }
|
|
|
| - ResolutionDartType getType(CommonElements types) =>
|
| - const ResolutionDynamicType();
|
| + DartType getType(CommonElements types) => types.dynamicType;
|
|
|
| ConstantValueKind get kind => ConstantValueKind.SYNTHETIC;
|
|
|
| @@ -708,7 +704,7 @@ class ConstructedConstantValue extends ObjectConstantValue {
|
| final int hashCode;
|
|
|
| ConstructedConstantValue(
|
| - ResolutionInterfaceType type, Map<FieldEntity, ConstantValue> fields)
|
| + InterfaceType type, Map<FieldEntity, ConstantValue> fields)
|
| : this.fields = fields,
|
| hashCode = Hashing.unorderedMapHash(fields, Hashing.objectHash(type)),
|
| super(type) {
|
| @@ -741,7 +737,7 @@ class ConstructedConstantValue extends ObjectConstantValue {
|
|
|
| String toDartText() {
|
| StringBuffer sb = new StringBuffer();
|
| - sb.write(type.name);
|
| + sb.write(type.element.name);
|
| _unparseTypeArguments(sb);
|
| sb.write('(');
|
| int i = 0;
|
| @@ -796,7 +792,7 @@ class DeferredConstantValue extends ConstantValue {
|
|
|
| accept(ConstantValueVisitor visitor, arg) => visitor.visitDeferred(this, arg);
|
|
|
| - ResolutionDartType getType(CommonElements types) => referenced.getType(types);
|
| + DartType getType(CommonElements types) => referenced.getType(types);
|
|
|
| ConstantValueKind get kind => ConstantValueKind.DEFERRED;
|
|
|
| @@ -822,8 +818,7 @@ class NonConstantValue extends ConstantValue {
|
| List<ConstantValue> getDependencies() => const <ConstantValue>[];
|
|
|
| @override
|
| - ResolutionDartType getType(CommonElements types) =>
|
| - const ResolutionDynamicType();
|
| + DartType getType(CommonElements types) => types.dynamicType;
|
|
|
| ConstantValueKind get kind => ConstantValueKind.NON_CONSTANT;
|
|
|
|
|