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

Unified Diff: runtime/vm/object.cc

Issue 2835363002: Properly handle implicit closure function when a generic function. (Closed)
Patch Set: address comment Created 3 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index cd65cdca8158940c0080f129c163cdc6c9cc16f1..465b8fca72c9c08ba87f9fa5b392a0a1bd98037a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5615,6 +5615,11 @@ void Function::set_parent_function(const Function& value) const {
bool Function::HasGenericParent() const {
+ if (IsImplicitClosureFunction()) {
+ // The parent function of an implicit closure function is not the enclosing
+ // function we are asking about here.
+ return false;
+ }
Function& parent = Function::Handle(parent_function());
while (!parent.IsNull()) {
if (parent.IsGeneric()) {
@@ -6013,6 +6018,9 @@ intptr_t Function::NumTypeParameters(Thread* thread) const {
intptr_t Function::NumParentTypeParameters() const {
+ if (IsImplicitClosureFunction()) {
+ return 0;
+ }
Thread* thread = Thread::Current();
Function& parent = Function::Handle(parent_function());
intptr_t num_parent_type_params = 0;
@@ -6051,6 +6059,11 @@ RawTypeParameter* Function::LookupTypeParameter(
}
}
}
+ if (function.IsImplicitClosureFunction()) {
+ // The parent function is not the enclosing function, but the closurized
+ // function with identical type parameters.
+ break;
+ }
function ^= function.parent_function();
if (function_level != NULL) {
(*function_level)--;

Powered by Google App Engine
This is Rietveld 408576698