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

Unified Diff: src/parser.cc

Issue 10897010: Introduce some predicates over variable modes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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/parser.h ('k') | src/scopes.cc » ('j') | src/v8globals.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 1ec133876c07cc20e5a084b101edeef36cb6a4e3..37e903aac9c1e9a249718f61351800e3edc9464f 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1802,8 +1802,8 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
name, mode, declaration->initialization(), proxy->interface());
} else if ((mode != VAR || var->mode() != VAR) &&
(!declaration_scope->is_global_scope() ||
- (mode != VAR && mode != CONST) ||
- (var->mode() != VAR && var->mode() != CONST))) {
+ IsLexicalVariableMode(mode) ||
+ IsLexicalVariableMode(var->mode()))) {
// The name was declared in this scope before; check for conflicting
// re-declarations. We have a conflict if either of the declarations is
// not a var (in the global scope, we also have to ignore legacy const for
@@ -1817,11 +1817,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
//
// because the var declaration is hoisted to the function scope where 'x'
// is already bound.
- // We only have vars, consts and lets in declarations.
- ASSERT(var->mode() == VAR ||
- var->mode() == CONST ||
- var->mode() == CONST_HARMONY ||
- var->mode() == LET);
+ ASSERT(IsDeclaredVariableMode(var->mode()));
if (is_extended_mode()) {
// In harmony mode we treat re-declarations as early errors. See
// ES5 16 for a definition of early errors.
@@ -2341,7 +2337,7 @@ Block* Parser::ParseVariableDeclarations(
// browsers where the global object (window) has lots of
// properties defined in prototype objects.
if (initialization_scope->is_global_scope() &&
- mode != LET && mode != CONST_HARMONY) {
+ !IsLexicalVariableMode(mode)) {
// Compute the arguments for the runtime call.
ZoneList<Expression*>* arguments =
new(zone()) ZoneList<Expression*>(3, zone());
« no previous file with comments | « src/parser.h ('k') | src/scopes.cc » ('j') | src/v8globals.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698