Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index cdbc6fe04dbf8f4fcbe5cee231017e8c56245046..8706750f55ffa2b29e35fa062d15df665136962d 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -838,6 +838,21 @@ Handle<Context> Factory::NewModuleContext(Handle<Module> module, |
return context; |
} |
+Handle<Context> Factory::NewEvalContext(Handle<Module> module, |
+ Handle<JSFunction> function, |
+ Handle<ScopeInfo> scope_info) { |
+ DCHECK_EQ(scope_info->scope_type(), EVAL_SCOPE); |
+ Handle<FixedArray> array = |
+ NewFixedArray(scope_info->ContextLength(), TENURED); |
+ array->set_map_no_write_barrier(*module_context_map()); |
+ Handle<Context> context = Handle<Context>::cast(array); |
+ context->set_closure(*function); |
+ context->set_previous(function->context()); |
+ context->set_extension(*module); |
+ context->set_native_context(function->native_context()); |
+ DCHECK(context->IsModuleContext()); |
+ return context; |
+} |
Handle<Context> Factory::NewFunctionContext(int length, |
Handle<JSFunction> function) { |