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

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
Index: runtime/lib/mirrors.cc
===================================================================
--- runtime/lib/mirrors.cc (revision 9646)
+++ runtime/lib/mirrors.cc (working copy)
@@ -328,10 +328,63 @@
return result;
}
+ int64_t fixed_param_count, opt_param_count;
turnidge 2012/07/13 23:37:12 We declare only one variable per line.
+ result = Dart_FunctionParameterCounts(
+ func,
+ &fixed_param_count,
+ &opt_param_count);
turnidge 2012/07/13 23:37:12 Since parameters are short, reindent like this: r
+ 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 parameter mirrors will more than whether they're opt.
turnidge 2012/07/13 23:37:12 Comment reads funny. Is there a typo?
+ for (int i = 0; i < fixed_param_count; i++) {
+ Dart_Handle args[] = {
+ Dart_False()
+ };
turnidge 2012/07/13 23:37:12 Since there's only one arg, put the initializer an
rmacnak 2012/07/16 17:36:39 I did that initially, but the linter complained. I
+ 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 +678,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 +700,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);

Powered by Google App Engine
This is Rietveld 408576698