| 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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 intptr_t* length) { | 1693 intptr_t* length) { |
| 1694 Isolate* isolate = Isolate::Current(); | 1694 Isolate* isolate = Isolate::Current(); |
| 1695 DARTSCOPE(isolate); | 1695 DARTSCOPE(isolate); |
| 1696 const String& str_obj = Api::UnwrapStringHandle(isolate, str); | 1696 const String& str_obj = Api::UnwrapStringHandle(isolate, str); |
| 1697 if (str_obj.IsNull()) { | 1697 if (str_obj.IsNull()) { |
| 1698 RETURN_TYPE_ERROR(isolate, str, String); | 1698 RETURN_TYPE_ERROR(isolate, str, String); |
| 1699 } | 1699 } |
| 1700 intptr_t str_len = str_obj.Length(); | 1700 intptr_t str_len = str_obj.Length(); |
| 1701 intptr_t copy_len = (str_len > *length) ? *length : str_len; | 1701 intptr_t copy_len = (str_len > *length) ? *length : str_len; |
| 1702 for (intptr_t i = 0; i < copy_len; i++) { | 1702 for (intptr_t i = 0; i < copy_len; i++) { |
| 1703 utf16_array[i] = static_cast<uint16_t>(str_obj.CharAt(i)); | 1703 utf16_array[i] = static_cast<uint16_t>(str_obj.CodeUnitAt(i)); |
| 1704 } | 1704 } |
| 1705 *length = copy_len; | 1705 *length = copy_len; |
| 1706 return Api::Success(isolate); | 1706 return Api::Success(isolate); |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 | 1709 |
| 1710 // --- Lists --- | 1710 // --- Lists --- |
| 1711 | 1711 |
| 1712 | 1712 |
| 1713 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) { | 1713 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) { |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2591 } | 2591 } |
| 2592 return Api::NewHandle(isolate, cls.signature_function()); | 2592 return Api::NewHandle(isolate, cls.signature_function()); |
| 2593 } | 2593 } |
| 2594 | 2594 |
| 2595 | 2595 |
| 2596 // --- Function and Variable Reflection --- | 2596 // --- Function and Variable Reflection --- |
| 2597 | 2597 |
| 2598 | 2598 |
| 2599 // Outside of the vm, we expose setter names with a trailing '='. | 2599 // Outside of the vm, we expose setter names with a trailing '='. |
| 2600 static bool HasExternalSetterSuffix(const String& name) { | 2600 static bool HasExternalSetterSuffix(const String& name) { |
| 2601 return name.CharAt(name.Length() - 1) == '='; | 2601 return name.CodeUnitAt(name.Length() - 1) == '='; |
| 2602 } | 2602 } |
| 2603 | 2603 |
| 2604 | 2604 |
| 2605 static RawString* RemoveExternalSetterSuffix(const String& name) { | 2605 static RawString* RemoveExternalSetterSuffix(const String& name) { |
| 2606 ASSERT(HasExternalSetterSuffix(name)); | 2606 ASSERT(HasExternalSetterSuffix(name)); |
| 2607 return String::SubString(name, 0, name.Length() - 1); | 2607 return String::SubString(name, 0, name.Length() - 1); |
| 2608 } | 2608 } |
| 2609 | 2609 |
| 2610 | 2610 |
| 2611 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) { | 2611 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) { |
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4444 } | 4444 } |
| 4445 { | 4445 { |
| 4446 NoGCScope no_gc; | 4446 NoGCScope no_gc; |
| 4447 RawObject* raw_obj = obj.raw(); | 4447 RawObject* raw_obj = obj.raw(); |
| 4448 isolate->heap()->SetPeer(raw_obj, peer); | 4448 isolate->heap()->SetPeer(raw_obj, peer); |
| 4449 } | 4449 } |
| 4450 return Api::Success(isolate); | 4450 return Api::Success(isolate); |
| 4451 } | 4451 } |
| 4452 | 4452 |
| 4453 } // namespace dart | 4453 } // namespace dart |
| OLD | NEW |