| Index: lib/compiler/implementation/constants.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/constants.dart (revision 12170)
|
| +++ lib/compiler/implementation/constants.dart (working copy)
|
| @@ -40,6 +40,8 @@
|
| bool isNaN() => false;
|
| bool isMinusZero() => false;
|
|
|
| + abstract DartType computeType(Compiler compiler);
|
| +
|
| abstract List<Constant> getDependencies();
|
|
|
| abstract accept(ConstantVisitor);
|
| @@ -77,6 +79,10 @@
|
| return new DartString.literal(element.name.slowToString());
|
| }
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.functionClass.computeType(compiler);
|
| + }
|
| +
|
| int hashCode() => (17 * element.hashCode()) & 0x7fffffff;
|
|
|
| accept(ConstantVisitor visitor) => visitor.visitFunction(this);
|
| @@ -109,6 +115,10 @@
|
| bool isNull() => true;
|
| get value => null;
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.nullClass.computeType(compiler);
|
| + }
|
| +
|
| void _writeJsCode(CodeBuffer buffer, ConstantHandler handler) {
|
| buffer.add(JsNull);
|
| }
|
| @@ -149,6 +159,10 @@
|
| const IntConstant._internal(this.value);
|
| bool isInt() => true;
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.intClass.computeType(compiler);
|
| + }
|
| +
|
| // We have to override the equality operator so that ints and doubles are
|
| // treated as separate constants.
|
| // The is [:!IntConstant:] check at the beginning of the function makes sure
|
| @@ -188,6 +202,10 @@
|
| // We need to check for the negative sign since -0.0 == 0.0.
|
| bool isMinusZero() => value == 0.0 && value.isNegative();
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.doubleClass.computeType(compiler);
|
| + }
|
| +
|
| bool operator ==(var other) {
|
| if (other is !DoubleConstant) return false;
|
| DoubleConstant otherDouble = other;
|
| @@ -214,6 +232,10 @@
|
| const BoolConstant._internal();
|
| bool isBool() => true;
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.boolClass.computeType(compiler);
|
| + }
|
| +
|
| abstract BoolConstant negate();
|
| }
|
|
|
| @@ -266,6 +288,10 @@
|
| }
|
| bool isString() => true;
|
|
|
| + DartType computeType(Compiler compiler) {
|
| + return compiler.stringClass.computeType(compiler);
|
| + }
|
| +
|
| bool operator ==(var other) {
|
| if (other is !StringConstant) return false;
|
| StringConstant otherString = other;
|
| @@ -285,6 +311,8 @@
|
| ObjectConstant(this.type);
|
| bool isObject() => true;
|
|
|
| + DartType computeType(Compiler compiler) => type;
|
| +
|
| // TODO(1603): The class should be marked as abstract, but the VM doesn't
|
| // currently allow this.
|
| abstract int hashCode();
|
|
|