OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 19824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19835 | 19835 |
19836 void Module::StoreExport(Handle<Module> module, Handle<String> name, | 19836 void Module::StoreExport(Handle<Module> module, Handle<String> name, |
19837 Handle<Object> value) { | 19837 Handle<Object> value) { |
19838 Handle<Cell> cell(Cell::cast(module->exports()->Lookup(name))); | 19838 Handle<Cell> cell(Cell::cast(module->exports()->Lookup(name))); |
19839 cell->set_value(*value); | 19839 cell->set_value(*value); |
19840 } | 19840 } |
19841 | 19841 |
19842 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { | 19842 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { |
19843 Isolate* isolate = module->GetIsolate(); | 19843 Isolate* isolate = module->GetIsolate(); |
19844 Handle<Object> object(module->exports()->Lookup(name), isolate); | 19844 Handle<Object> object(module->exports()->Lookup(name), isolate); |
19845 | |
19846 // TODO(neis): Namespace imports are not yet implemented. Trying to use this | |
19847 // feature may crash here. | |
19848 if (!object->IsCell()) UNIMPLEMENTED(); | |
19849 | |
19850 return handle(Handle<Cell>::cast(object)->value(), isolate); | 19845 return handle(Handle<Cell>::cast(object)->value(), isolate); |
19851 } | 19846 } |
19852 | 19847 |
19853 Handle<Object> Module::LoadImport(Handle<Module> module, Handle<String> name, | 19848 Handle<Object> Module::LoadImport(Handle<Module> module, Handle<String> name, |
19854 int module_request) { | 19849 int module_request) { |
19855 Isolate* isolate = module->GetIsolate(); | 19850 Isolate* isolate = module->GetIsolate(); |
19856 Handle<Module> requested_module( | 19851 Handle<Module> requested_module( |
19857 Module::cast(module->requested_modules()->get(module_request)), isolate); | 19852 Module::cast(module->requested_modules()->get(module_request)), isolate); |
19858 return Module::LoadExport(requested_module, name); | 19853 return Module::LoadExport(requested_module, name); |
19859 } | 19854 } |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20256 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) | 20251 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) |
20257 .Check(); | 20252 .Check(); |
20258 } | 20253 } |
20259 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); | 20254 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); |
20260 | 20255 |
20261 return ns; | 20256 return ns; |
20262 } | 20257 } |
20263 | 20258 |
20264 } // namespace internal | 20259 } // namespace internal |
20265 } // namespace v8 | 20260 } // namespace v8 |
OLD | NEW |