| Index: runtime/vm/dart_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.cc (revision 14922)
|
| +++ runtime/vm/dart_api_impl.cc (working copy)
|
| @@ -3939,39 +3939,18 @@
|
| DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args,
|
| int index) {
|
| NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
|
| - const int apparent_count = Dart_GetNativeArgumentCount(args);
|
| - if ((index < 0) || (index >= apparent_count)) {
|
| + if ((index < 0) || (index >= arguments->NativeArgCount())) {
|
| return Api::NewError(
|
| "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
|
| - CURRENT_FUNC, apparent_count - 1, index);
|
| + CURRENT_FUNC, arguments->NativeArgCount() - 1, index);
|
| }
|
| - // Hide closure object if present.
|
| - index += arguments->Count() - apparent_count;
|
| -
|
| - Isolate* isolate = arguments->isolate();
|
| - CHECK_ISOLATE(isolate);
|
| - if (index == 0) {
|
| - if (arguments->ToInstanceFunction() && arguments->ToClosureFunction()) {
|
| - // Retrieve the receiver from the context.
|
| - const Context& context = Context::Handle(isolate->top_context());
|
| - return Api::NewHandle(isolate, context.At(0));
|
| - }
|
| - }
|
| - return Api::NewHandle(isolate, arguments->At(index));
|
| + return Api::NewHandle(arguments->isolate(), arguments->NativeArgAt(index));
|
| }
|
|
|
|
|
| DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) {
|
| NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
|
| - int count = arguments->Count();
|
| - // In the instance closure function case, the receiver is accessed from
|
| - // the context and the closure at index 0 is hidden, so the apparent
|
| - // argument count remains unchanged.
|
| - if (arguments->ToClosureFunction() && !arguments->ToInstanceFunction()) {
|
| - // The closure at index 0 is hidden and therefore not counted.
|
| - count--;
|
| - }
|
| - return count;
|
| + return arguments->NativeArgCount();
|
| }
|
|
|
|
|
|
|