| 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 4337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4348 const Object& prefix_object = | 4348 const Object& prefix_object = |
| 4349 Object::Handle(isolate, Api::UnwrapHandle(prefix)); | 4349 Object::Handle(isolate, Api::UnwrapHandle(prefix)); |
| 4350 const String& prefix_vm = prefix_object.IsNull() | 4350 const String& prefix_vm = prefix_object.IsNull() |
| 4351 ? String::Handle(isolate, Symbols::New("")) | 4351 ? String::Handle(isolate, Symbols::New("")) |
| 4352 : String::Cast(prefix_object); | 4352 : String::Cast(prefix_object); |
| 4353 if (prefix_vm.IsNull()) { | 4353 if (prefix_vm.IsNull()) { |
| 4354 RETURN_TYPE_ERROR(isolate, prefix, String); | 4354 RETURN_TYPE_ERROR(isolate, prefix, String); |
| 4355 } | 4355 } |
| 4356 const String& prefix_symbol = | 4356 const String& prefix_symbol = |
| 4357 String::Handle(isolate, Symbols::New(prefix_vm)); | 4357 String::Handle(isolate, Symbols::New(prefix_vm)); |
| 4358 const Namespace& import_ns = Namespace::Handle( |
| 4359 Namespace::New(import_vm, Array::Handle(), Array::Handle())); |
| 4358 if (prefix_vm.Length() == 0) { | 4360 if (prefix_vm.Length() == 0) { |
| 4359 library_vm.AddImport(import_vm); | 4361 library_vm.AddImport(import_ns); |
| 4360 } else { | 4362 } else { |
| 4361 LibraryPrefix& library_prefix = LibraryPrefix::Handle(); | 4363 LibraryPrefix& library_prefix = LibraryPrefix::Handle(); |
| 4362 library_prefix = library_vm.LookupLocalLibraryPrefix(prefix_symbol); | 4364 library_prefix = library_vm.LookupLocalLibraryPrefix(prefix_symbol); |
| 4363 if (!library_prefix.IsNull()) { | 4365 if (!library_prefix.IsNull()) { |
| 4364 library_prefix.AddLibrary(import_vm); | 4366 library_prefix.AddImport(import_ns); |
| 4365 } else { | 4367 } else { |
| 4366 library_prefix = LibraryPrefix::New(prefix_symbol, import_vm); | 4368 library_prefix = LibraryPrefix::New(prefix_symbol, import_ns); |
| 4367 library_vm.AddObject(library_prefix, prefix_symbol); | 4369 library_vm.AddObject(library_prefix, prefix_symbol); |
| 4368 } | 4370 } |
| 4369 } | 4371 } |
| 4370 return Api::Success(isolate); | 4372 return Api::Success(isolate); |
| 4371 } | 4373 } |
| 4372 | 4374 |
| 4373 | 4375 |
| 4374 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 4376 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
| 4375 Dart_Handle url, | 4377 Dart_Handle url, |
| 4376 Dart_Handle source) { | 4378 Dart_Handle source) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4489 } | 4491 } |
| 4490 { | 4492 { |
| 4491 NoGCScope no_gc; | 4493 NoGCScope no_gc; |
| 4492 RawObject* raw_obj = obj.raw(); | 4494 RawObject* raw_obj = obj.raw(); |
| 4493 isolate->heap()->SetPeer(raw_obj, peer); | 4495 isolate->heap()->SetPeer(raw_obj, peer); |
| 4494 } | 4496 } |
| 4495 return Api::Success(isolate); | 4497 return Api::Success(isolate); |
| 4496 } | 4498 } |
| 4497 | 4499 |
| 4498 } // namespace dart | 4500 } // namespace dart |
| OLD | NEW |