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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 2206483004: Sloppy eval declarations should not shadow lexical function declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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.cc ('k') | test/mjsunit/es6/block-eval-var-over-let.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index e38c56ef6bcd424de24fce004b50f85b36fab695..4baef7b99ed012728fbbe5545cf85b3818d92c18 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -267,10 +267,12 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
int index;
PropertyAttributes attributes;
BindingFlags binding_flags;
+ VariableMode mode;
// Check for a conflict with a lexically scoped variable
- context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes, &binding_flags);
- if (attributes != ABSENT && binding_flags == BINDING_CHECK_INITIALIZED) {
+ context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes, &binding_flags,
+ &mode);
+ if (attributes != ABSENT && IsLexicalVariableMode(mode)) {
// ES#sec-evaldeclarationinstantiation 5.a.i.1:
// If varEnvRec.HasLexicalDeclaration(name) is true, throw a SyntaxError
// exception.
@@ -281,7 +283,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
}
Handle<Object> holder = context->Lookup(name, DONT_FOLLOW_CHAINS, &index,
- &attributes, &binding_flags);
+ &attributes, &binding_flags, &mode);
DCHECK(!isolate->has_pending_exception());
Handle<JSObject> object;
@@ -771,8 +773,9 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
int index;
PropertyAttributes attributes;
BindingFlags flags;
+ VariableMode mode;
Handle<Object> holder = isolate->context()->Lookup(
- name, FOLLOW_CHAINS, &index, &attributes, &flags);
+ name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
// If the slot was not found the result is true.
if (holder.is_null()) {
@@ -806,8 +809,9 @@ MaybeHandle<Object> LoadLookupSlot(Handle<String> name,
int index;
PropertyAttributes attributes;
BindingFlags flags;
+ VariableMode mode;
Handle<Object> holder = isolate->context()->Lookup(
- name, FOLLOW_CHAINS, &index, &attributes, &flags);
+ name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
if (index != Context::kNotFound) {
@@ -909,8 +913,9 @@ MaybeHandle<Object> StoreLookupSlot(Handle<String> name, Handle<Object> value,
int index;
PropertyAttributes attributes;
BindingFlags flags;
+ VariableMode mode;
Handle<Object> holder =
- context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flags);
+ context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
if (holder.is_null()) {
// In case of JSProxy, an exception might have been thrown.
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
« no previous file with comments | « src/contexts.cc ('k') | test/mjsunit/es6/block-eval-var-over-let.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698