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

Unified Diff: runtime/lib/mirrors.cc

Issue 2793033005: Keep types in signatures of function types properly instantiated as the function (Closed)
Patch Set: added comment and sync 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
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index ca62ecf4be549015438ad3b7e11f702513ed4b0a..067df19571c0f2e7997db31ccb3be44ad4e7e72f 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -966,14 +966,13 @@ DEFINE_NATIVE_ENTRY(FunctionTypeMirror_parameters, 2) {
}
-DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 2) {
+DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
- GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, instantiator,
- arguments->NativeArgAt(1));
const Function& func = Function::Handle(ref.GetFunctionReferent());
ASSERT(!func.IsNull());
AbstractType& type = AbstractType::Handle(func.result_type());
- return InstantiateType(type, instantiator);
+ // Signatures of function types are instantiated, but not canonical.
+ return type.Canonicalize();
}
@@ -1947,7 +1946,8 @@ DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 2) {
GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
// We handle constructors in Dart code.
ASSERT(!func.IsGenerativeConstructor());
- const AbstractType& type = AbstractType::Handle(func.result_type());
+ AbstractType& type = AbstractType::Handle(func.result_type());
+ type ^= type.Canonicalize(); // Instantiated signatures are not canonical.
return InstantiateType(type, instantiator);
}
@@ -2071,8 +2071,9 @@ DEFINE_NATIVE_ENTRY(ParameterMirror_type, 3) {
GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1));
GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(2));
const Function& func = Function::Handle(ref.GetFunctionReferent());
- const AbstractType& type = AbstractType::Handle(
+ AbstractType& type = AbstractType::Handle(
func.ParameterTypeAt(func.NumImplicitParameters() + pos.Value()));
+ type ^= type.Canonicalize(); // Instantiated signatures are not canonical.
return InstantiateType(type, instantiator);
}
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698