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

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

Issue 1382513003: Test for var declarations in eval which conflict with let (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index c3928a7703a6f3bd5c37661d888d404be5e93b8f..4d7ea1f47a445e1fe08534497cb9f9e77c556171 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -223,8 +223,18 @@ Object* DeclareLookupSlot(Isolate* isolate, Handle<String> name,
int index;
PropertyAttributes attributes;
- ContextLookupFlags flags = DONT_FOLLOW_CHAINS;
+ ContextLookupFlags flags;
BindingFlags binding_flags;
+
+ // Check for a conflict with a lexically scoped variable
+ flags = LEXICAL_TEST;
adamk 2015/10/05 17:20:36 Rather than re-assignining this variable it seems
Dan Ehrenberg 2015/10/08 23:01:26 Done
+ context_arg->Lookup(name, flags, &index, &attributes, &binding_flags);
adamk 2015/10/05 17:20:36 It seems a shame to do this extra context chain wa
Dan Ehrenberg 2015/10/08 23:01:26 Done
+ if (attributes != ABSENT && (binding_flags == MUTABLE_CHECK_INITIALIZED ||
+ binding_flags == IMMUTABLE_CHECK_INITIALIZED)) {
+ return ThrowRedeclarationError(isolate, name);
+ }
+
+ flags = DONT_FOLLOW_CHAINS;
Handle<Object> holder =
context->Lookup(name, flags, &index, &attributes, &binding_flags);
if (holder.is_null()) {

Powered by Google App Engine
This is Rietveld 408576698