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

Unified Diff: runtime/lib/mirrors.cc

Issue 19983003: Create ParameterMirror.type lazily. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 2e6f6afecb254018d482d81f3606d9e3a8494384..7e4770e3a5355ecf875f800741ed51195caafb6e 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -236,6 +236,7 @@ static Dart_Handle CreateLazyMirror(Dart_Handle target);
static Dart_Handle CreateParameterMirrorList(Dart_Handle func) {
+ ASSERT(Dart_IsFunction(func));
int64_t fixed_param_count;
int64_t opt_param_count;
Dart_Handle result = Dart_FunctionParameterCounts(func,
@@ -257,13 +258,11 @@ static Dart_Handle CreateParameterMirrorList(Dart_Handle func) {
return param_type;
}
+ Dart_Handle reflectee = CreateMirrorReference(func);
for (int64_t i = 0; i < param_count; i++) {
- Dart_Handle arg_type = Dart_FunctionParameterType(func, i);
- if (Dart_IsError(arg_type)) {
- return arg_type;
- }
Dart_Handle args[] = {
- CreateLazyMirror(arg_type),
+ reflectee,
+ Dart_NewInteger(i),
Dart_NewBoolean(i >= fixed_param_count), // optional param?
siva 2013/07/23 00:02:29 (i >= fixed_param_count) ? Api::True() : Api::Fals
Michael Lippautz (Google) 2013/07/23 00:39:11 Done.
};
Dart_Handle param =
@@ -1863,4 +1862,14 @@ DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 1) {
return CreateTypeMirror(return_type);
}
+
+DEFINE_NATIVE_ENTRY(ParameterMirror_type, 2) {
+ GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
+ GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1));
+ const Function& func = Function::Handle(ref.GetFunctionReferent());
+ const AbstractType& param_type = AbstractType::Handle(func.ParameterTypeAt(
+ func.NumImplicitParameters() + pos.Value()));
+ return CreateTypeMirror(param_type);
+}
+
} // namespace dart
« 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