Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index b500ef41fb16036a63982b6c0f46c25f19f861ab..814a4dfa9f8660a731893f566ecb6bc9461edba9 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2082,7 +2082,12 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext( |
if (!extension->IsJSObject()) return Local<Function>(); |
i::Handle<i::JSFunction> closure(context->closure(), isolate); |
context = factory->NewWithContext( |
- closure, context, i::ScopeInfo::CreateForWithScope(isolate), extension); |
+ closure, context, |
+ i::ScopeInfo::CreateForWithScope( |
+ isolate, context->IsNativeContext() |
+ ? i::Handle<i::ScopeInfo>::null() |
+ : i::Handle<i::ScopeInfo>(context->scope_info())), |
+ extension); |
} |
i::Handle<i::Object> name_obj; |