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

Side by Side Diff: src/parser.cc

Issue 385613002: Parser sync tests for `let` identifiers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 init_op = Token::INIT_CONST; 2006 init_op = Token::INIT_CONST;
2007 } else { 2007 } else {
2008 ReportMessage("strict_const"); 2008 ReportMessage("strict_const");
2009 *ok = false; 2009 *ok = false;
2010 return NULL; 2010 return NULL;
2011 } 2011 }
2012 } 2012 }
2013 is_const = true; 2013 is_const = true;
2014 needs_init = true; 2014 needs_init = true;
2015 } else if (peek() == Token::LET && strict_mode() == STRICT) { 2015 } else if (peek() == Token::LET && strict_mode() == STRICT) {
2016 ASSERT(allow_harmony_scoping());
2016 Consume(Token::LET); 2017 Consume(Token::LET);
2017 if (var_context == kStatement) { 2018 if (var_context == kStatement) {
2018 // Let declarations are only allowed in source element positions. 2019 // Let declarations are only allowed in source element positions.
2019 ReportMessage("unprotected_let"); 2020 ReportMessage("unprotected_let");
2020 *ok = false; 2021 *ok = false;
2021 return NULL; 2022 return NULL;
2022 } 2023 }
2023 mode = LET; 2024 mode = LET;
2024 needs_init = true; 2025 needs_init = true;
2025 init_op = Token::INIT_LET; 2026 init_op = Token::INIT_LET;
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 scope_ = saved_scope; 3046 scope_ = saved_scope;
3046 for_scope->set_end_position(scanner()->location().end_pos); 3047 for_scope->set_end_position(scanner()->location().end_pos);
3047 for_scope = for_scope->FinalizeBlockScope(); 3048 for_scope = for_scope->FinalizeBlockScope();
3048 ASSERT(for_scope == NULL); 3049 ASSERT(for_scope == NULL);
3049 // Parsed for-in loop w/ variable/const declaration. 3050 // Parsed for-in loop w/ variable/const declaration.
3050 return result; 3051 return result;
3051 } else { 3052 } else {
3052 init = variable_statement; 3053 init = variable_statement;
3053 } 3054 }
3054 } else if (peek() == Token::LET && strict_mode() == STRICT) { 3055 } else if (peek() == Token::LET && strict_mode() == STRICT) {
3056 ASSERT(allow_harmony_scoping());
3055 const AstRawString* name = NULL; 3057 const AstRawString* name = NULL;
3056 VariableDeclarationProperties decl_props = kHasNoInitializers; 3058 VariableDeclarationProperties decl_props = kHasNoInitializers;
3057 Block* variable_statement = 3059 Block* variable_statement =
3058 ParseVariableDeclarations(kForStatement, &decl_props, &let_bindings, 3060 ParseVariableDeclarations(kForStatement, &decl_props, &let_bindings,
3059 &name, CHECK_OK); 3061 &name, CHECK_OK);
3060 bool accept_IN = name != NULL && decl_props != kHasInitializers; 3062 bool accept_IN = name != NULL && decl_props != kHasInitializers;
3061 bool accept_OF = decl_props == kHasNoInitializers; 3063 bool accept_OF = decl_props == kHasNoInitializers;
3062 ForEachStatement::VisitMode mode; 3064 ForEachStatement::VisitMode mode;
3063 3065
3064 if (accept_IN && CheckInOrOf(accept_OF, &mode)) { 3066 if (accept_IN && CheckInOrOf(accept_OF, &mode)) {
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 info()->SetAstValueFactory(ast_value_factory_); 4797 info()->SetAstValueFactory(ast_value_factory_);
4796 } 4798 }
4797 ast_value_factory_ = NULL; 4799 ast_value_factory_ = NULL;
4798 4800
4799 InternalizeUseCounts(); 4801 InternalizeUseCounts();
4800 4802
4801 return (result != NULL); 4803 return (result != NULL);
4802 } 4804 }
4803 4805
4804 } } // namespace v8::internal 4806 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698