| Index: src/contexts.cc
|
| diff --git a/src/contexts.cc b/src/contexts.cc
|
| index a008d49ac37ebfdf9e47cdcb995eac2fba591918..a18f181bef8ccb3e0ca80d43dc5a1f3107105d73 100644
|
| --- a/src/contexts.cc
|
| +++ b/src/contexts.cc
|
| @@ -264,7 +264,8 @@ Handle<Object> Context::Lookup(Handle<String> name,
|
| }
|
|
|
| // 1. Check global objects, subjects of with, and extension objects.
|
| - if ((context->IsNativeContext() || context->IsWithContext() ||
|
| + if ((context->IsNativeContext() ||
|
| + (context->IsWithContext() && ((flags & SKIP_WITH_CONTEXT) == 0)) ||
|
| context->IsFunctionContext() || context->IsBlockContext()) &&
|
| context->extension_receiver() != nullptr) {
|
| Handle<JSReceiver> object(context->extension_receiver());
|
| @@ -384,7 +385,9 @@ Handle<Object> Context::Lookup(Handle<String> name,
|
| }
|
|
|
| // 3. Prepare to continue with the previous (next outermost) context.
|
| - if (context->IsNativeContext()) {
|
| + if (context->IsNativeContext() ||
|
| + ((flags & STOP_AT_DECLARATION_SCOPE) != 0 &&
|
| + context->is_declaration_context())) {
|
| follow_context_chain = false;
|
| } else {
|
| context = Handle<Context>(context->previous(), isolate);
|
|
|