| OLD | NEW |
| 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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 | 1033 |
| 1034 Token::Value tok = peek(); | 1034 Token::Value tok = peek(); |
| 1035 if (tok != Token::CATCH && tok != Token::FINALLY) { | 1035 if (tok != Token::CATCH && tok != Token::FINALLY) { |
| 1036 ReportMessageAt(scanner()->location(), MessageTemplate::kNoCatchOrFinally); | 1036 ReportMessageAt(scanner()->location(), MessageTemplate::kNoCatchOrFinally); |
| 1037 *ok = false; | 1037 *ok = false; |
| 1038 return Statement::Default(); | 1038 return Statement::Default(); |
| 1039 } | 1039 } |
| 1040 if (tok == Token::CATCH) { | 1040 if (tok == Token::CATCH) { |
| 1041 Consume(Token::CATCH); | 1041 Consume(Token::CATCH); |
| 1042 Expect(Token::LPAREN, CHECK_OK); | 1042 Expect(Token::LPAREN, CHECK_OK); |
| 1043 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); | 1043 ExpressionClassifier pattern_classifier; |
| 1044 ParsePrimaryExpression(&pattern_classifier, CHECK_OK); |
| 1045 ValidateBindingPattern(&pattern_classifier, CHECK_OK); |
| 1044 Expect(Token::RPAREN, CHECK_OK); | 1046 Expect(Token::RPAREN, CHECK_OK); |
| 1045 { | 1047 { |
| 1048 // TODO(adamk): Make this CATCH_SCOPE |
| 1046 Scope* with_scope = NewScope(scope_, WITH_SCOPE); | 1049 Scope* with_scope = NewScope(scope_, WITH_SCOPE); |
| 1047 BlockState block_state(&scope_, with_scope); | 1050 BlockState block_state(&scope_, with_scope); |
| 1048 ParseBlock(CHECK_OK); | 1051 ParseBlock(CHECK_OK); |
| 1049 } | 1052 } |
| 1050 tok = peek(); | 1053 tok = peek(); |
| 1051 } | 1054 } |
| 1052 if (tok == Token::FINALLY) { | 1055 if (tok == Token::FINALLY) { |
| 1053 Consume(Token::FINALLY); | 1056 Consume(Token::FINALLY); |
| 1054 ParseBlock(CHECK_OK); | 1057 ParseBlock(CHECK_OK); |
| 1055 } | 1058 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 Expect(Token::RBRACE, CHECK_OK); | 1268 Expect(Token::RBRACE, CHECK_OK); |
| 1266 return PreParserExpression::Default(); | 1269 return PreParserExpression::Default(); |
| 1267 } | 1270 } |
| 1268 } | 1271 } |
| 1269 | 1272 |
| 1270 #undef CHECK_OK | 1273 #undef CHECK_OK |
| 1271 | 1274 |
| 1272 | 1275 |
| 1273 } // namespace internal | 1276 } // namespace internal |
| 1274 } // namespace v8 | 1277 } // namespace v8 |
| OLD | NEW |