Index: sdk/lib/_internal/compiler/implementation/constants.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/constants.dart b/sdk/lib/_internal/compiler/implementation/constants.dart |
index 6e20124983af46d758df100113e5424b07e555a8..99495d6d5d36f635ba37fee64fa5958636fe51d4 100644 |
--- a/sdk/lib/_internal/compiler/implementation/constants.dart |
+++ b/sdk/lib/_internal/compiler/implementation/constants.dart |
@@ -16,6 +16,7 @@ abstract class ConstantVisitor<R> { |
R visitList(ListConstant constant); |
R visitMap(MapConstant constant); |
R visitConstructed(ConstructedConstant constant); |
+ R visitType(TypeConstant constant); |
} |
abstract class Constant { |
@@ -42,11 +43,13 @@ abstract class Constant { |
bool isNaN() => false; |
bool isMinusZero() => false; |
+ bool get isType => false; |
ngeoffray
2012/11/15 16:07:24
bool isType() => false and move it to where the ot
karlklose
2012/11/19 15:08:58
Done.
|
+ |
DartType computeType(Compiler compiler); |
List<Constant> getDependencies(); |
- accept(ConstantVisitor); |
+ accept(ConstantVisitor visitor); |
} |
class SentinelConstant extends Constant { |
@@ -316,11 +319,35 @@ abstract class ObjectConstant extends Constant { |
DartType computeType(Compiler compiler) => type; |
- // TODO(1603): The class should be marked as abstract, but the VM doesn't |
- // currently allow this. |
int get hashCode; |
floitsch
2012/11/16 13:53:31
Remove the hashCode line too.
karlklose
2012/11/19 15:08:58
Done.
|
} |
+class TypeConstant extends Constant { |
ngeoffray
2012/11/15 16:07:24
extends ObjectConstant ?
karlklose
2012/11/19 15:08:58
Done.
|
+ /// The user type that this constant represents. |
+ final DartType representedType; |
+ /// The type of the constant (currently always [Type]). |
ngeoffray
2012/11/15 16:07:24
Should it be something else? Please add a comment.
karlklose
2012/11/19 15:08:58
It could be more specific in the future, but the c
|
+ final DartType type; |
+ |
+ TypeConstant(this.representedType, this.type); |
+ |
+ bool get isType => true; |
+ bool isObject() => true; |
+ |
+ DartType computeType(Compiler compiler) { |
+ return compiler.typeClass.computeType(compiler); |
ngeoffray
2012/11/15 16:07:24
Remove, it will be inherited with ObjectConstant.
karlklose
2012/11/19 15:08:58
Done.
|
+ } |
+ |
+ bool operator ==(other) { |
+ return other is TypeConstant && representedType == other.representedType; |
+ } |
+ |
+ int get hashCode => representedType.hashCode * 13; |
+ |
+ List<Constant> getDependencies() => const <Constant>[]; |
+ |
+ accept(ConstantVisitor visitor) => visitor.visitType(this); |
+} |
+ |
class ListConstant extends ObjectConstant { |
final List<Constant> entries; |
final int hashCode; |