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

Side by Side Diff: src/preparser.cc

Issue 927953003: [strong] Forbid var. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: loop w const omg Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // const ConstBinding (',' ConstBinding)* ';' 422 // const ConstBinding (',' ConstBinding)* ';'
423 // ConstBinding :: 423 // ConstBinding ::
424 // Identifier '=' AssignmentExpression 424 // Identifier '=' AssignmentExpression
425 // 425 //
426 // TODO(ES6): 426 // TODO(ES6):
427 // ConstBinding :: 427 // ConstBinding ::
428 // BindingPattern '=' AssignmentExpression 428 // BindingPattern '=' AssignmentExpression
429 bool require_initializer = false; 429 bool require_initializer = false;
430 bool is_strict_const = false; 430 bool is_strict_const = false;
431 if (peek() == Token::VAR) { 431 if (peek() == Token::VAR) {
432 if (is_strong(language_mode())) {
433 Scanner::Location location = scanner()->peek_location();
434 ReportMessageAt(location, "strong_var");
435 *ok = false;
436 return Statement::Default();
437 }
432 Consume(Token::VAR); 438 Consume(Token::VAR);
433 } else if (peek() == Token::CONST) { 439 } else if (peek() == Token::CONST) {
434 // TODO(ES6): The ES6 Draft Rev4 section 12.2.2 reads: 440 // TODO(ES6): The ES6 Draft Rev4 section 12.2.2 reads:
435 // 441 //
436 // ConstDeclaration : const ConstBinding (',' ConstBinding)* ';' 442 // ConstDeclaration : const ConstBinding (',' ConstBinding)* ';'
437 // 443 //
438 // * It is a Syntax Error if the code that matches this production is not 444 // * It is a Syntax Error if the code that matches this production is not
439 // contained in extended code. 445 // contained in extended code.
440 // 446 //
441 // However disallowing const in sloppy mode will break compatibility with 447 // However disallowing const in sloppy mode will break compatibility with
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 1025 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
1020 ParseArguments(ok); 1026 ParseArguments(ok);
1021 1027
1022 return Expression::Default(); 1028 return Expression::Default();
1023 } 1029 }
1024 1030
1025 #undef CHECK_OK 1031 #undef CHECK_OK
1026 1032
1027 1033
1028 } } // v8::internal 1034 } } // v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698