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

Unified Diff: src/parsing/parser.cc

Issue 1485943002: Defer CONST_LEGACY redeclaration errors until runtime in harmony mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | test/mjsunit/regress/regress-4576.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 968c78e205df01e0dc581008535d60760dbbb781..991ccc6bb52e517ceaf167e5be032977c3934a0c 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -2093,7 +2093,9 @@ Variable* Parser::Declare(Declaration* declaration,
// because the var declaration is hoisted to the function scope where 'x'
// is already bound.
DCHECK(IsDeclaredVariableMode(var->mode()));
- if (is_strict(language_mode()) || allow_harmony_sloppy()) {
+ if (is_strict(language_mode()) ||
+ (allow_harmony_sloppy() && mode != CONST_LEGACY &&
+ var->mode() != CONST_LEGACY)) {
// In harmony we treat re-declarations as early errors. See
// ES5 16 for a definition of early errors.
if (declaration_kind == DeclarationDescriptor::NORMAL) {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4576.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698