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

Unified Diff: runtime/vm/parser.cc

Issue 1087463005: Simplification in resolving classes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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 | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 45377)
+++ runtime/vm/parser.cc (working copy)
@@ -11346,18 +11346,16 @@
}
}
// The referenced class may not have been parsed yet. It would be wrong
- // to resolve it too early to an imported class of the same name.
+ // to resolve it too early to an imported class of the same name. Only
+ // resolve the class when a finalized type is requested.
if (finalization > ClassFinalizer::kResolveTypeParameters) {
- // Resolve classname in the scope of the current library.
- resolved_type_class = ResolveClassInCurrentLibraryScope(
- unresolved_class_name);
+ resolved_type_class = library_.LookupClass(unresolved_class_name);
}
} else {
- LibraryPrefix& lib_prefix =
+ // Resolve class name in the scope of the library prefix.
+ const LibraryPrefix& lib_prefix =
LibraryPrefix::Handle(Z, unresolved_class.library_prefix());
- // Resolve class name in the scope of the library prefix.
- resolved_type_class =
- ResolveClassInPrefixScope(lib_prefix, unresolved_class_name);
+ resolved_type_class = lib_prefix.LookupClass(unresolved_class_name);
}
// At this point, we can only have a parameterized_type.
const Type& parameterized_type = Type::Cast(*type);
@@ -11713,16 +11711,6 @@
}
-RawClass* Parser::ResolveClassInCurrentLibraryScope(const String& name) {
- HANDLESCOPE(I);
- const Object& obj = Object::Handle(Z, library_.ResolveName(name));
- if (obj.IsClass()) {
- return Class::Cast(obj).raw();
- }
- return Class::null();
-}
-
-
// Resolve an identifier by checking the global scope of the current
// library. If not found in the current library, then look in the scopes
// of all libraries that are imported without a library prefix.
@@ -11764,17 +11752,6 @@
}
-RawClass* Parser::ResolveClassInPrefixScope(const LibraryPrefix& prefix,
- const String& name) {
- HANDLESCOPE(I);
- const Object& obj = Object::Handle(Z, prefix.LookupObject(name));
- if (obj.IsClass()) {
- return Class::Cast(obj).raw();
- }
- return Class::null();
-}
-
-
// Do a lookup for the identifier in the scope of the specified
// library prefix. This means trying to resolve it locally in all of the
// libraries present in the library prefix.
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698