Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Unified Diff: lib/compiler/implementation/constants.dart

Issue 10908143: Support check mode for statics. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698