OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 4600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4611 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 4611 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
4612 if (lib.IsNull()) { | 4612 if (lib.IsNull()) { |
4613 RETURN_TYPE_ERROR(Z, library, Library); | 4613 RETURN_TYPE_ERROR(Z, library, Library); |
4614 } | 4614 } |
4615 if (!Utils::IsUint(16, field_count)) { | 4615 if (!Utils::IsUint(16, field_count)) { |
4616 return Api::NewError( | 4616 return Api::NewError( |
4617 "Invalid field_count passed to Dart_CreateNativeWrapperClass"); | 4617 "Invalid field_count passed to Dart_CreateNativeWrapperClass"); |
4618 } | 4618 } |
4619 CHECK_CALLBACK_STATE(T); | 4619 CHECK_CALLBACK_STATE(T); |
4620 | 4620 |
4621 String& cls_symbol = String::Handle(Z, Symbols::New(cls_name)); | 4621 String& cls_symbol = String::Handle(Z, Symbols::New(T, cls_name)); |
4622 const Class& cls = Class::Handle(Z, | 4622 const Class& cls = Class::Handle(Z, |
4623 Class::NewNativeWrapper(lib, cls_symbol, field_count)); | 4623 Class::NewNativeWrapper(lib, cls_symbol, field_count)); |
4624 if (cls.IsNull()) { | 4624 if (cls.IsNull()) { |
4625 return Api::NewError( | 4625 return Api::NewError( |
4626 "Unable to create native wrapper class : already exists"); | 4626 "Unable to create native wrapper class : already exists"); |
4627 } | 4627 } |
4628 return Api::NewHandle(T, cls.RareType()); | 4628 return Api::NewHandle(T, cls.RareType()); |
4629 } | 4629 } |
4630 | 4630 |
4631 | 4631 |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5465 const Object& prefix_object = Object::Handle(Z, Api::UnwrapHandle(prefix)); | 5465 const Object& prefix_object = Object::Handle(Z, Api::UnwrapHandle(prefix)); |
5466 const String& prefix_vm = prefix_object.IsNull() | 5466 const String& prefix_vm = prefix_object.IsNull() |
5467 ? Symbols::Empty() | 5467 ? Symbols::Empty() |
5468 : String::Cast(prefix_object); | 5468 : String::Cast(prefix_object); |
5469 if (prefix_vm.IsNull()) { | 5469 if (prefix_vm.IsNull()) { |
5470 RETURN_TYPE_ERROR(Z, prefix, String); | 5470 RETURN_TYPE_ERROR(Z, prefix, String); |
5471 } | 5471 } |
5472 CHECK_CALLBACK_STATE(T); | 5472 CHECK_CALLBACK_STATE(T); |
5473 CHECK_COMPILATION_ALLOWED(I); | 5473 CHECK_COMPILATION_ALLOWED(I); |
5474 | 5474 |
5475 const String& prefix_symbol = String::Handle(Z, Symbols::New(prefix_vm)); | 5475 const String& prefix_symbol = String::Handle(Z, Symbols::New(T, prefix_vm)); |
5476 const Namespace& import_ns = Namespace::Handle(Z, | 5476 const Namespace& import_ns = Namespace::Handle(Z, |
5477 Namespace::New(import_vm, Object::null_array(), Object::null_array())); | 5477 Namespace::New(import_vm, Object::null_array(), Object::null_array())); |
5478 if (prefix_vm.Length() == 0) { | 5478 if (prefix_vm.Length() == 0) { |
5479 library_vm.AddImport(import_ns); | 5479 library_vm.AddImport(import_ns); |
5480 } else { | 5480 } else { |
5481 LibraryPrefix& library_prefix = LibraryPrefix::Handle(); | 5481 LibraryPrefix& library_prefix = LibraryPrefix::Handle(); |
5482 library_prefix = library_vm.LookupLocalLibraryPrefix(prefix_symbol); | 5482 library_prefix = library_vm.LookupLocalLibraryPrefix(prefix_symbol); |
5483 if (!library_prefix.IsNull()) { | 5483 if (!library_prefix.IsNull()) { |
5484 library_prefix.AddImport(import_ns); | 5484 library_prefix.AddImport(import_ns); |
5485 } else { | 5485 } else { |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6120 return Api::Success(); | 6120 return Api::Success(); |
6121 } | 6121 } |
6122 #endif // DART_PRECOMPILER | 6122 #endif // DART_PRECOMPILER |
6123 | 6123 |
6124 | 6124 |
6125 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6125 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
6126 return Dart::IsRunningPrecompiledCode(); | 6126 return Dart::IsRunningPrecompiledCode(); |
6127 } | 6127 } |
6128 | 6128 |
6129 } // namespace dart | 6129 } // namespace dart |
OLD | NEW |