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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 2736733005: Manage and capture class and function instantiators in the parser. (Closed)
Patch Set: work in progress Created 3 years, 9 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 | « no previous file | runtime/vm/code_descriptors_test.cc » ('j') | runtime/vm/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 6d88977e09f4c83e27c9e7590a9ad370a4f80d9f..e094d0f869bf6be00908e91cf02d92ef81bbd37f 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -1163,21 +1163,25 @@ RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls,
const TypeParameter& type_parameter = TypeParameter::Cast(type);
const Class& parameterized_class =
Class::Handle(zone, type_parameter.parameterized_class());
- ASSERT(!parameterized_class.IsNull());
- // The index must reflect the position of this type parameter in the type
- // arguments vector of its parameterized class. The offset to add is the
- // number of type arguments in the super type, which is equal to the
- // difference in number of type arguments and type parameters of the
- // parameterized class.
- const intptr_t offset = parameterized_class.NumTypeArguments() -
- parameterized_class.NumTypeParameters();
- // Calling NumTypeParameters() may finalize this type parameter if it
- // belongs to a mixin application class.
- if (!type_parameter.IsFinalized()) {
- type_parameter.set_index(type_parameter.index() + offset);
- type_parameter.SetIsFinalized();
+ if (!parameterized_class.IsNull()) {
+ // The index must reflect the position of this type parameter in the type
+ // arguments vector of its parameterized class. The offset to add is the
+ // number of type arguments in the super type, which is equal to the
+ // difference in number of type arguments and type parameters of the
+ // parameterized class.
+ const intptr_t offset = parameterized_class.NumTypeArguments() -
+ parameterized_class.NumTypeParameters();
+ // Calling NumTypeParameters() may finalize this type parameter if it
+ // belongs to a mixin application class.
+ if (!type_parameter.IsFinalized()) {
+ type_parameter.set_index(type_parameter.index() + offset);
+ type_parameter.SetIsFinalized();
+ } else {
+ ASSERT(cls.IsMixinApplication());
+ }
} else {
- ASSERT(cls.IsMixinApplication());
+ // A function type parameter is always finalized.
+ ASSERT(type_parameter.IsFinalized());
}
if (FLAG_trace_type_finalization) {
« no previous file with comments | « no previous file | runtime/vm/code_descriptors_test.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698