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

Unified Diff: runtime/lib/mirrors.cc

Issue 62273003: Use the runtime for generic subsitution of variable types, return types, parameter types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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') | runtime/lib/mirrors_impl.dart » ('J')
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 22b2d47fa4b2ea1c81d9c35b3526026b3b24293d..28647a7f53ac684055ba707e3d87f05485ef002f 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1901,12 +1901,18 @@ DEFINE_NATIVE_ENTRY(MethodMirror_parameters, 2) {
}
-DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 1) {
+DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Function& func = Function::Handle(ref.GetFunctionReferent());
+ GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
// We handle constructors in Dart code.
ASSERT(!func.IsConstructor());
- return func.result_type();
+ const AbstractType& type = AbstractType::Handle(func.result_type());
+ if (instantiator.IsNull()) {
rmacnak 2013/11/06 18:40:33 Null in the case the method is top-level, librarie
regis 2013/11/06 19:06:07 You could have a null instantiator, because the in
rmacnak 2013/11/07 19:56:00 The instantiator here isn't a type vector, it's th
+ return type.raw();
+ } else {
+ return InstantiateType(type, instantiator);
+ }
}
@@ -1952,18 +1958,31 @@ DEFINE_NATIVE_ENTRY(TypedefMirror_referent, 1) {
}
-DEFINE_NATIVE_ENTRY(ParameterMirror_type, 2) {
+DEFINE_NATIVE_ENTRY(ParameterMirror_type, 3) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
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());
- return func.ParameterTypeAt(func.NumImplicitParameters() + pos.Value());
+ const AbstractType& type = AbstractType::Handle(
+ func.ParameterTypeAt(func.NumImplicitParameters() + pos.Value()));
+ if (instantiator.IsNull()) {
regis 2013/11/06 19:06:07 ditto
+ return type.raw();
+ } else {
+ return InstantiateType(type, instantiator);
+ }
}
-DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
+DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Field& field = Field::Handle(ref.GetFieldReferent());
- return field.type();
+ GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
+ const AbstractType& type = AbstractType::Handle(field.type());
+ if (instantiator.IsNull()) {
regis 2013/11/06 19:06:07 ditto
+ return type.raw();
+ } else {
+ return InstantiateType(type, instantiator);
+ }
}
} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/lib/mirrors_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698