| 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 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 | 2460 |
| 2461 // --- Classes and Interfaces --- | 2461 // --- Classes and Interfaces --- |
| 2462 | 2462 |
| 2463 | 2463 |
| 2464 DART_EXPORT bool Dart_IsClass(Dart_Handle handle) { | 2464 DART_EXPORT bool Dart_IsClass(Dart_Handle handle) { |
| 2465 Isolate* isolate = Isolate::Current(); | 2465 Isolate* isolate = Isolate::Current(); |
| 2466 DARTSCOPE(isolate); | 2466 DARTSCOPE(isolate); |
| 2467 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 2467 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 2468 if (obj.IsClass()) { | 2468 return obj.IsClass(); |
| 2469 return !Class::Cast(obj).is_interface(); | |
| 2470 } | |
| 2471 return false; | |
| 2472 } | |
| 2473 | |
| 2474 | |
| 2475 DART_EXPORT bool Dart_IsInterface(Dart_Handle handle) { | |
| 2476 Isolate* isolate = Isolate::Current(); | |
| 2477 DARTSCOPE(isolate); | |
| 2478 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | |
| 2479 if (obj.IsClass()) { | |
| 2480 return Class::Cast(obj).is_interface(); | |
| 2481 } | |
| 2482 return false; | |
| 2483 } | 2469 } |
| 2484 | 2470 |
| 2485 | 2471 |
| 2486 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle clazz) { | 2472 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle clazz) { |
| 2487 Isolate* isolate = Isolate::Current(); | 2473 Isolate* isolate = Isolate::Current(); |
| 2488 DARTSCOPE(isolate); | 2474 DARTSCOPE(isolate); |
| 2489 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); | 2475 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2490 if (cls.IsNull()) { | 2476 if (cls.IsNull()) { |
| 2491 RETURN_TYPE_ERROR(isolate, clazz, Class); | 2477 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2492 } | 2478 } |
| (...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4451 } | 4437 } |
| 4452 { | 4438 { |
| 4453 NoGCScope no_gc; | 4439 NoGCScope no_gc; |
| 4454 RawObject* raw_obj = obj.raw(); | 4440 RawObject* raw_obj = obj.raw(); |
| 4455 isolate->heap()->SetPeer(raw_obj, peer); | 4441 isolate->heap()->SetPeer(raw_obj, peer); |
| 4456 } | 4442 } |
| 4457 return Api::Success(isolate); | 4443 return Api::Success(isolate); |
| 4458 } | 4444 } |
| 4459 | 4445 |
| 4460 } // namespace dart | 4446 } // namespace dart |
| OLD | NEW |