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

Unified Diff: src/contexts.cc

Issue 2302783002: [modules] Basic support of exports (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.h ('k') | src/debug/debug-scopes.cc » ('j') | src/factory.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 0822e45cd0ed71e4a878acf92ba84da04f67760d..7db29766c637794000ca438e23a6af8748a294ce 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -110,7 +110,7 @@ JSReceiver* Context::extension_receiver() {
ScopeInfo* Context::scope_info() {
- DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext());
+ DCHECK(IsScriptContext() || IsBlockContext());
HeapObject* object = extension();
if (object->IsSloppyBlockWithEvalContextExtension()) {
DCHECK(IsBlockContext());
@@ -120,6 +120,16 @@ ScopeInfo* Context::scope_info() {
}
+JSModule* Context::module() {
+ Context* current = this;
+ while (!current->IsModuleContext()) {
+ current = current->previous();
+ DCHECK_NOT_NULL(current); // XXX
adamk 2016/09/01 23:13:34 In our offline discussion I said this was a bit bo
neis 2016/09/02 11:32:58 Done.
+ }
+ return JSModule::cast(current->extension());
+}
+
+
String* Context::catch_name() {
DCHECK(IsCatchContext());
return String::cast(extension());
@@ -185,6 +195,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
int* index, PropertyAttributes* attributes,
InitializationFlag* init_flag,
VariableMode* variable_mode) {
+ DCHECK(!IsModuleContext());
Isolate* isolate = GetIsolate();
Handle<Context> context(this, isolate);
« no previous file with comments | « src/contexts.h ('k') | src/debug/debug-scopes.cc » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698