Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/objects.cc

Issue 2360063002: [modules] Basic support of import statements. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19590 matching lines...) Expand 10 before | Expand all | Expand 10 after
19601 cell->set_value(*value); 19601 cell->set_value(*value);
19602 } 19602 }
19603 19603
19604 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) { 19604 Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) {
19605 Isolate* isolate = module->GetIsolate(); 19605 Isolate* isolate = module->GetIsolate();
19606 Handle<ObjectHashTable> exports(module->exports(), isolate); 19606 Handle<ObjectHashTable> exports(module->exports(), isolate);
19607 Handle<Cell> cell(Cell::cast(exports->Lookup(name))); 19607 Handle<Cell> cell(Cell::cast(exports->Lookup(name)));
19608 return handle(cell->value(), isolate); 19608 return handle(cell->value(), isolate);
19609 } 19609 }
19610 19610
19611 Handle<Object> Module::LoadImport(Handle<Module> module, Handle<String> name,
19612 int module_request) {
19613 Isolate* isolate = module->GetIsolate();
19614 Handle<Module> requested_module(
19615 Module::cast(module->requested_modules()->get(module_request)), isolate);
19616 Handle<ObjectHashTable> exports(requested_module->exports(), isolate);
19617 Object* object = exports->Lookup(name);
19618 if (!object->IsCell()) UNIMPLEMENTED();
19619 return handle(Cell::cast(object)->value(), isolate);
19620 }
19621
19611 } // namespace internal 19622 } // namespace internal
19612 } // namespace v8 19623 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698