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

Unified Diff: runtime/vm/dart_api_impl.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/lib/mirrors_impl.dart ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 9677)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -2857,6 +2857,34 @@
}
+DART_EXPORT Dart_Handle Dart_FunctionParameterCounts(
+ Dart_Handle function,
+ int64_t* fixed_param_count,
+ int64_t* opt_param_count) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ if (fixed_param_count == NULL) {
+ RETURN_NULL_ERROR(fixed_param_count);
+ }
+ if (opt_param_count == NULL) {
+ RETURN_NULL_ERROR(opt_param_count);
+ }
+ const Function& func = Api::UnwrapFunctionHandle(isolate, function);
+ if (func.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, function, Function);
+ }
+
+ // We hide implicit parameters, such as a method's receiver. This is
+ // consistent with Invoke or New, which don't expect their callers to
+ // provide them in the argument lists they are handed.
+ *fixed_param_count = (func.num_fixed_parameters() -
+ func.NumberOfImplicitParameters());
+ *opt_param_count = func.num_optional_parameters();
+
+ return Api::Success(isolate);
+}
+
+
DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698