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

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

Issue 10533126: Remove string constants from Types class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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
« no previous file with comments | « dart/lib/compiler/implementation/resolver.dart ('k') | dart/tests/language/prefix_core_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/typechecker.dart
diff --git a/dart/lib/compiler/implementation/typechecker.dart b/dart/lib/compiler/implementation/typechecker.dart
index e440e37db7a7893a00f321e7632c3c7696625bb6..f7af728c82d0e26475f72e4005f537d71d0599ab 100644
--- a/dart/lib/compiler/implementation/typechecker.dart
+++ b/dart/lib/compiler/implementation/typechecker.dart
@@ -62,7 +62,7 @@ class StatementType implements Type {
class VoidType implements Type {
const VoidType(this.element);
- SourceString get name() => Types.VOID;
+ SourceString get name() => element.name;
final VoidElement element;
toString() => name.slowToString();
@@ -116,15 +116,6 @@ class FunctionType implements Type {
}
class Types {
- static final VOID = const SourceString('void');
- static final INT = const SourceString('int');
- static final DOUBLE = const SourceString('double');
- static final DYNAMIC = const SourceString('Dynamic');
- static final STRING = const SourceString('String');
- static final BOOL = const SourceString('bool');
- static final OBJECT = const SourceString('Object');
- static final LIST = const SourceString('List');
-
final VoidType voidType;
final InterfaceType dynamicType;
@@ -136,19 +127,11 @@ class Types {
: voidType = new VoidType(new VoidElement(library)),
dynamicType = new InterfaceType(dynamicElement);
- Type lookup(SourceString s) {
- if (VOID == s) {
- return voidType;
- } else if (DYNAMIC == s || s.stringValue === 'var') {
- return dynamicType;
- }
- return null;
- }
-
/** Returns true if t is a subtype of s */
bool isSubtype(Type t, Type s) {
if (t === s || t === dynamicType || s === dynamicType ||
- s.name == OBJECT) return true;
+ // TODO(karlklose): Test for s.element === compiler.objectClass.
+ s.name == const SourceString('Object')) return true;
if (t is VoidType) {
return false;
} else if (t is InterfaceType) {
« no previous file with comments | « dart/lib/compiler/implementation/resolver.dart ('k') | dart/tests/language/prefix_core_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698