| 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 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 } | 2456 } |
| 2457 dart_arguments.Add(&arg); | 2457 dart_arguments.Add(&arg); |
| 2458 } | 2458 } |
| 2459 const Array& kNoArgumentNames = Array::Handle(isolate); | 2459 const Array& kNoArgumentNames = Array::Handle(isolate); |
| 2460 return Api::NewHandle( | 2460 return Api::NewHandle( |
| 2461 isolate, | 2461 isolate, |
| 2462 DartEntry::InvokeClosure(closure_obj, dart_arguments, kNoArgumentNames)); | 2462 DartEntry::InvokeClosure(closure_obj, dart_arguments, kNoArgumentNames)); |
| 2463 } | 2463 } |
| 2464 | 2464 |
| 2465 | 2465 |
| 2466 // --- Classes and Interfaces --- | 2466 // --- Classes --- |
| 2467 | 2467 |
| 2468 | 2468 |
| 2469 DART_EXPORT bool Dart_IsClass(Dart_Handle handle) { | 2469 DART_EXPORT bool Dart_IsClass(Dart_Handle handle) { |
| 2470 Isolate* isolate = Isolate::Current(); | 2470 Isolate* isolate = Isolate::Current(); |
| 2471 DARTSCOPE(isolate); | 2471 DARTSCOPE(isolate); |
| 2472 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 2472 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 2473 if (obj.IsClass()) { | 2473 return obj.IsClass(); |
| 2474 return !Class::Cast(obj).is_interface(); | |
| 2475 } | |
| 2476 return false; | |
| 2477 } | 2474 } |
| 2478 | 2475 |
| 2479 | 2476 |
| 2480 DART_EXPORT bool Dart_IsInterface(Dart_Handle handle) { | 2477 DART_EXPORT bool Dart_IsAbstractClass(Dart_Handle handle) { |
| 2481 Isolate* isolate = Isolate::Current(); | 2478 Isolate* isolate = Isolate::Current(); |
| 2482 DARTSCOPE(isolate); | 2479 DARTSCOPE(isolate); |
| 2483 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 2480 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 2484 if (obj.IsClass()) { | 2481 if (obj.IsClass()) { |
| 2485 return Class::Cast(obj).is_interface(); | 2482 return Class::Cast(obj).is_abstract(); |
| 2486 } | 2483 } |
| 2487 return false; | 2484 return false; |
| 2488 } | 2485 } |
| 2489 | 2486 |
| 2490 | 2487 |
| 2491 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle clazz) { | 2488 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle clazz) { |
| 2492 Isolate* isolate = Isolate::Current(); | 2489 Isolate* isolate = Isolate::Current(); |
| 2493 DARTSCOPE(isolate); | 2490 DARTSCOPE(isolate); |
| 2494 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); | 2491 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2495 if (cls.IsNull()) { | 2492 if (cls.IsNull()) { |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4456 } | 4453 } |
| 4457 { | 4454 { |
| 4458 NoGCScope no_gc; | 4455 NoGCScope no_gc; |
| 4459 RawObject* raw_obj = obj.raw(); | 4456 RawObject* raw_obj = obj.raw(); |
| 4460 isolate->heap()->SetPeer(raw_obj, peer); | 4457 isolate->heap()->SetPeer(raw_obj, peer); |
| 4461 } | 4458 } |
| 4462 return Api::Success(isolate); | 4459 return Api::Success(isolate); |
| 4463 } | 4460 } |
| 4464 | 4461 |
| 4465 } // namespace dart | 4462 } // namespace dart |
| OLD | NEW |