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 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 return Api::NewHandle(isolate, rf); | 2490 return Api::NewHandle(isolate, rf); |
2491 } | 2491 } |
2492 | 2492 |
2493 | 2493 |
2494 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, | 2494 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, |
2495 int number_of_arguments, | 2495 int number_of_arguments, |
2496 Dart_Handle* arguments) { | 2496 Dart_Handle* arguments) { |
2497 Isolate* isolate = Isolate::Current(); | 2497 Isolate* isolate = Isolate::Current(); |
2498 DARTSCOPE(isolate); | 2498 DARTSCOPE(isolate); |
2499 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); | 2499 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); |
2500 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { | 2500 if (closure_obj.IsNull() || !closure_obj.IsCallable(NULL, NULL)) { |
2501 RETURN_TYPE_ERROR(isolate, closure, Instance); | 2501 RETURN_TYPE_ERROR(isolate, closure, Instance); |
2502 } | 2502 } |
2503 if (number_of_arguments < 0) { | 2503 if (number_of_arguments < 0) { |
2504 return Api::NewError( | 2504 return Api::NewError( |
2505 "%s expects argument 'number_of_arguments' to be non-negative.", | 2505 "%s expects argument 'number_of_arguments' to be non-negative.", |
2506 CURRENT_FUNC); | 2506 CURRENT_FUNC); |
2507 } | 2507 } |
2508 ASSERT(ClassFinalizer::AllClassesFinalized()); | 2508 ASSERT(ClassFinalizer::AllClassesFinalized()); |
2509 | 2509 |
2510 // Now try to invoke the closure. | 2510 // Now try to invoke the closure. |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4506 } | 4506 } |
4507 { | 4507 { |
4508 NoGCScope no_gc; | 4508 NoGCScope no_gc; |
4509 RawObject* raw_obj = obj.raw(); | 4509 RawObject* raw_obj = obj.raw(); |
4510 isolate->heap()->SetPeer(raw_obj, peer); | 4510 isolate->heap()->SetPeer(raw_obj, peer); |
4511 } | 4511 } |
4512 return Api::Success(isolate); | 4512 return Api::Success(isolate); |
4513 } | 4513 } |
4514 | 4514 |
4515 } // namespace dart | 4515 } // namespace dart |
OLD | NEW |