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

Side by Side Diff: src/preparser.cc

Issue 1417483014: [es6] Implement destructuring binding in try/catch (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix CheckConflictingVariableDeclarations to deal with destructuring 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 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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1022
1023 Token::Value tok = peek(); 1023 Token::Value tok = peek();
1024 if (tok != Token::CATCH && tok != Token::FINALLY) { 1024 if (tok != Token::CATCH && tok != Token::FINALLY) {
1025 ReportMessageAt(scanner()->location(), MessageTemplate::kNoCatchOrFinally); 1025 ReportMessageAt(scanner()->location(), MessageTemplate::kNoCatchOrFinally);
1026 *ok = false; 1026 *ok = false;
1027 return Statement::Default(); 1027 return Statement::Default();
1028 } 1028 }
1029 if (tok == Token::CATCH) { 1029 if (tok == Token::CATCH) {
1030 Consume(Token::CATCH); 1030 Consume(Token::CATCH);
1031 Expect(Token::LPAREN, CHECK_OK); 1031 Expect(Token::LPAREN, CHECK_OK);
1032 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); 1032 ExpressionClassifier pattern_classifier;
1033 ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
1034 ValidateBindingPattern(&pattern_classifier, CHECK_OK);
1033 Expect(Token::RPAREN, CHECK_OK); 1035 Expect(Token::RPAREN, CHECK_OK);
1034 { 1036 {
1037 // TODO(adamk): Make this CATCH_SCOPE
1035 Scope* with_scope = NewScope(scope_, WITH_SCOPE); 1038 Scope* with_scope = NewScope(scope_, WITH_SCOPE);
1036 BlockState block_state(&scope_, with_scope); 1039 BlockState block_state(&scope_, with_scope);
1037 ParseBlock(CHECK_OK); 1040 ParseBlock(CHECK_OK);
1038 } 1041 }
1039 tok = peek(); 1042 tok = peek();
1040 } 1043 }
1041 if (tok == Token::FINALLY) { 1044 if (tok == Token::FINALLY) {
1042 Consume(Token::FINALLY); 1045 Consume(Token::FINALLY);
1043 ParseBlock(CHECK_OK); 1046 ParseBlock(CHECK_OK);
1044 } 1047 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 Expect(Token::RBRACE, CHECK_OK); 1257 Expect(Token::RBRACE, CHECK_OK);
1255 return PreParserExpression::Default(); 1258 return PreParserExpression::Default();
1256 } 1259 }
1257 } 1260 }
1258 1261
1259 #undef CHECK_OK 1262 #undef CHECK_OK
1260 1263
1261 1264
1262 } // namespace internal 1265 } // namespace internal
1263 } // namespace v8 1266 } // namespace v8
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