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

Unified Diff: dart/lib/compiler/implementation/resolver.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
Index: dart/lib/compiler/implementation/resolver.dart
diff --git a/dart/lib/compiler/implementation/resolver.dart b/dart/lib/compiler/implementation/resolver.dart
index 8be9f01a927b4f85c8e7f78c38fd1386e9aada03..51d973636f06ca40323d6305966a9b76b6a465c2 100644
--- a/dart/lib/compiler/implementation/resolver.dart
+++ b/dart/lib/compiler/implementation/resolver.dart
@@ -367,7 +367,7 @@ class InitializerResolver {
FunctionElement result;
if (isSuperCall) {
// Calculate correct lookup target and constructor name.
- if (lookupTarget.name == Types.OBJECT) {
+ if (lookupTarget === visitor.compiler.objectClass) {
error(diagnosticNode, MessageKind.SUPER_INITIALIZER_IN_OBJECT);
} else {
lookupTarget = lookupTarget.supertype.element;
@@ -603,7 +603,7 @@ class TypeResolver {
if (send !== null) {
typeName = send.selector;
}
- if (typeName.source == Types.VOID) {
+ if (typeName.source.stringValue === 'void') {
return compiler.types.voidType.element;
} else if (send !== null) {
Element e = context.lookup(send.receiver.asIdentifier().source);
@@ -1593,12 +1593,13 @@ class ClassResolverVisitor extends CommonResolverVisitor<Type> {
} else if (supertype !== null) {
error(node.superclass, MessageKind.TYPE_NAME_EXPECTED);
}
- if (classElement.name != Types.OBJECT && classElement.supertype === null) {
- ClassElement objectElement = context.lookup(Types.OBJECT);
- if (objectElement !== null && !objectElement.isResolved) {
+ final objectElement = compiler.objectClass;
+ if (classElement !== objectElement && classElement.supertype === null) {
+ if (objectElement === null) {
+ compiler.internalError("Internal error: cannot resolve Object",
+ node: node);
+ } else if (!objectElement.isResolved) {
compiler.resolver.toResolve.add(objectElement);
- } else if (objectElement === null){
- error(node, MessageKind.CANNOT_RESOLVE_TYPE, [Types.OBJECT]);
}
classElement.supertype = new InterfaceType(objectElement);
}
« no previous file with comments | « dart/lib/compiler/implementation/elements/elements.dart ('k') | dart/lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698