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