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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 1654273003: Fix typedef cycle check (fixes #25620). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/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
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 8f705b21fa2cd19c4be8a926b970efe691d3dcca..cdeb898c86174f659beba381a2d595e333072cf2 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -2570,7 +2570,15 @@ bool ClassFinalizer::IsTypedefCycleFree(const Class& cls,
AbstractType& other_type = AbstractType::Handle();
if (resolved_type.IsFunctionType()) {
const Class& scope_class = Class::Handle(resolved_type.type_class());
- if (!scope_class.is_type_finalized() && scope_class.IsTypedefClass()) {
+ const Function& signature_function =
+ Function::Handle(FunctionType::Cast(resolved_type).signature());
+ // The signature function of this function type may be a local signature
+ // function used in a formal parameter type of the typedef signature, but
+ // not the typedef signature function itself, thus not qualifying as an
+ // illegal self reference.
+ if (!scope_class.is_type_finalized() &&
+ scope_class.IsTypedefClass() &&
+ (scope_class.signature_function() == signature_function.raw())) {
checking_typedef = true;
const intptr_t scope_class_id = scope_class.id();
ASSERT(visited != NULL);
@@ -2597,16 +2605,14 @@ bool ClassFinalizer::IsTypedefCycleFree(const Class& cls,
}
}
// Check the result type of the signature of this function type.
- const Function& function =
- Function::Handle(FunctionType::Cast(resolved_type).signature());
- other_type = function.result_type();
+ other_type = signature_function.result_type();
if (!IsTypedefCycleFree(cls, other_type, visited)) {
return false;
}
// Check the parameter types of the signature of this function type.
- const intptr_t num_parameters = function.NumParameters();
+ const intptr_t num_parameters = signature_function.NumParameters();
for (intptr_t i = 0; i < num_parameters; i++) {
- other_type = function.ParameterTypeAt(i);
+ other_type = signature_function.ParameterTypeAt(i);
if (!IsTypedefCycleFree(cls, other_type, visited)) {
return false;
}
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698