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

Unified Diff: runtime/lib/mirrors.cc

Issue 10778005: Add a limited version of ParameterMirrors that can only tell whether they are (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/include/dart_api.h ('k') | 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
===================================================================
--- runtime/lib/mirrors.cc (revision 9677)
+++ runtime/lib/mirrors.cc (working copy)
@@ -328,10 +328,60 @@
return result;
}
+ int64_t fixed_param_count;
+ int64_t opt_param_count;
+ result = Dart_FunctionParameterCounts(func,
+ &fixed_param_count,
+ &opt_param_count);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+
+ Dart_Handle parameter_mirrors =
+ Dart_NewList(fixed_param_count + opt_param_count);
+ if (Dart_IsError(parameter_mirrors)) {
+ return result;
+ }
+
+ Dart_Handle param_cls_name = Dart_NewString("_LocalParameterMirrorImpl");
+ Dart_Handle param_cls = Dart_GetClass(MirrorLib(), param_cls_name);
+ if (Dart_IsError(param_cls)) {
+ return param_cls;
+ }
+
+ // TODO(rmacnak): Fill the parameter mirrors with more than whether they are
+ // are optional.
+ for (int i = 0; i < fixed_param_count; i++) {
+ Dart_Handle args[] = { Dart_False() };
+ Dart_Handle fixed_param =
+ Dart_New(param_cls, Dart_Null(), ARRAY_SIZE(args), args);
+ if (Dart_IsError(fixed_param)) {
+ return fixed_param;
+ }
+ result = Dart_ListSetAt(parameter_mirrors, i, fixed_param);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+ }
+
+ for (int i = 0; i < opt_param_count; i++) {
+ Dart_Handle args[] = { Dart_True() };
+ Dart_Handle opt_param =
+ Dart_New(param_cls, Dart_Null(), ARRAY_SIZE(args), args);
+ if (Dart_IsError(opt_param)) {
+ return opt_param;
+ }
+ result = Dart_ListSetAt(parameter_mirrors, i+fixed_param_count, opt_param);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+ }
+
// TODO(turnidge): Implement constructor kinds (arguments 7 - 10).
Dart_Handle args[] = {
func_name,
lib_mirror,
+ parameter_mirrors,
Dart_NewBoolean(is_static),
Dart_NewBoolean(is_abstract),
Dart_NewBoolean(is_getter),
@@ -625,7 +675,6 @@
Dart_Handle args[] = {
CreateVMReference(Dart_Null()),
CreateLazyMirror(object_class),
- Dart_True(),
Dart_Null(),
};
Dart_Handle mirror = Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
@@ -648,11 +697,9 @@
return instance_cls;
}
- bool is_simple = IsSimpleValue(instance);
Dart_Handle args[] = {
CreateVMReference(instance),
CreateLazyMirror(instance_cls),
- Dart_NewBoolean(is_simple),
instance
};
Dart_Handle mirror = Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698