| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 return Api::NewHandle(isolate, rf); | 2443 return Api::NewHandle(isolate, rf); |
| 2444 } | 2444 } |
| 2445 | 2445 |
| 2446 | 2446 |
| 2447 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, | 2447 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, |
| 2448 int number_of_arguments, | 2448 int number_of_arguments, |
| 2449 Dart_Handle* arguments) { | 2449 Dart_Handle* arguments) { |
| 2450 Isolate* isolate = Isolate::Current(); | 2450 Isolate* isolate = Isolate::Current(); |
| 2451 DARTSCOPE(isolate); | 2451 DARTSCOPE(isolate); |
| 2452 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); | 2452 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); |
| 2453 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { | 2453 if (closure_obj.IsNull() || !closure_obj.IsCallable(NULL, NULL)) { |
| 2454 RETURN_TYPE_ERROR(isolate, closure, Instance); | 2454 RETURN_TYPE_ERROR(isolate, closure, Instance); |
| 2455 } | 2455 } |
| 2456 if (number_of_arguments < 0) { | 2456 if (number_of_arguments < 0) { |
| 2457 return Api::NewError( | 2457 return Api::NewError( |
| 2458 "%s expects argument 'number_of_arguments' to be non-negative.", | 2458 "%s expects argument 'number_of_arguments' to be non-negative.", |
| 2459 CURRENT_FUNC); | 2459 CURRENT_FUNC); |
| 2460 } | 2460 } |
| 2461 ASSERT(ClassFinalizer::AllClassesFinalized()); | 2461 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 2462 | 2462 |
| 2463 // Now try to invoke the closure. | 2463 // Now try to invoke the closure. |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4459 } | 4459 } |
| 4460 { | 4460 { |
| 4461 NoGCScope no_gc; | 4461 NoGCScope no_gc; |
| 4462 RawObject* raw_obj = obj.raw(); | 4462 RawObject* raw_obj = obj.raw(); |
| 4463 isolate->heap()->SetPeer(raw_obj, peer); | 4463 isolate->heap()->SetPeer(raw_obj, peer); |
| 4464 } | 4464 } |
| 4465 return Api::Success(isolate); | 4465 return Api::Success(isolate); |
| 4466 } | 4466 } |
| 4467 | 4467 |
| 4468 } // namespace dart | 4468 } // namespace dart |
| OLD | NEW |