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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 160753004: Do not resolve type arguments when only a resolved type class is needed to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/class_finalizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 32616)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -421,44 +421,56 @@
}
-void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) {
- if (type.IsResolved() || type.IsFinalized()) {
+void ClassFinalizer::ResolveTypeClass(const Class& cls,
+ const AbstractType& type) {
+ if (type.IsFinalized() || type.HasResolvedTypeClass()) {
return;
}
if (FLAG_trace_type_finalization) {
- OS::Print("Resolve type '%s'\n", String::Handle(type.Name()).ToCString());
+ OS::Print("Resolve type class of '%s'\n",
+ String::Handle(type.Name()).ToCString());
}
- // Resolve the type class.
- if (!type.HasResolvedTypeClass()) {
- // Type parameters are always resolved in the parser in the correct
- // non-static scope or factory scope. That resolution scope is unknown here.
- // Being able to resolve a type parameter from class cls here would indicate
- // that the type parameter appeared in a static scope. Leaving the type as
- // unresolved is the correct thing to do.
+ // Type parameters are always resolved in the parser in the correct
+ // non-static scope or factory scope. That resolution scope is unknown here.
+ // Being able to resolve a type parameter from class cls here would indicate
+ // that the type parameter appeared in a static scope. Leaving the type as
+ // unresolved is the correct thing to do.
- // Lookup the type class.
- const UnresolvedClass& unresolved_class =
- UnresolvedClass::Handle(type.unresolved_class());
- const Class& type_class =
- Class::Handle(ResolveClass(cls, unresolved_class));
+ // Lookup the type class.
+ const UnresolvedClass& unresolved_class =
+ UnresolvedClass::Handle(type.unresolved_class());
+ const Class& type_class =
+ Class::Handle(ResolveClass(cls, unresolved_class));
- // Replace unresolved class with resolved type class.
- const Type& parameterized_type = Type::Cast(type);
- if (type_class.IsNull()) {
- // The type class could not be resolved. The type is malformed.
- FinalizeMalformedType(
- Error::Handle(), // No previous error.
- Script::Handle(cls.script()),
- parameterized_type,
- "cannot resolve class '%s' from '%s'",
- String::Handle(unresolved_class.Name()).ToCString(),
- String::Handle(cls.Name()).ToCString());
- return;
- }
- parameterized_type.set_type_class(type_class);
+ // Replace unresolved class with resolved type class.
+ const Type& parameterized_type = Type::Cast(type);
+ if (type_class.IsNull()) {
+ // The type class could not be resolved. The type is malformed.
+ FinalizeMalformedType(
+ Error::Handle(), // No previous error.
+ Script::Handle(cls.script()),
+ parameterized_type,
+ "cannot resolve class '%s' from '%s'",
+ String::Handle(unresolved_class.Name()).ToCString(),
+ String::Handle(cls.Name()).ToCString());
+ return;
}
+ parameterized_type.set_type_class(type_class);
+}
+
+void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) {
+ // TODO(regis): Add a kResolved bit in type_state_ for efficiency.
+ if (type.IsFinalized() || type.IsResolved()) {
+ return;
+ }
+ if (FLAG_trace_type_finalization) {
+ OS::Print("Resolve type '%s'\n", String::Handle(type.Name()).ToCString());
+ }
+
+ ResolveTypeClass(cls, type);
+
// Resolve type arguments, if any.
const TypeArguments& arguments = TypeArguments::Handle(type.arguments());
if (!arguments.IsNull()) {
« no previous file with comments | « runtime/vm/class_finalizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698