Skip to content

Commit

Permalink
Intercept function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
fhinkel committed Jul 27, 2016
1 parent f3373a7 commit aef3aed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions deps/v8/src/runtime/runtime-scopes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<JSGlobalObject> global,
}

// Do the lookup own properties only, see ES5 erratum.
LookupIterator it(global, name, global,
LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
LookupIterator::Configuration configuration =
LookupIterator::Configuration::HIDDEN_SKIP_INTERCEPTOR;
if (is_function) {
// for function declarations, use the interceptor on the declaration,
// otherwise use it only on initialization
configuration = LookupIterator::Configuration::DEFAULT;
}
LookupIterator it(global, name, global, configuration);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return isolate->heap()->exception();

Expand Down

0 comments on commit aef3aed

Please sign in to comment.