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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ExpressionClassifier pattern_classifier; | 1032 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); |
1033 ParsePrimaryExpression(&pattern_classifier, CHECK_OK); | |
1034 ValidateBindingPattern(&pattern_classifier, CHECK_OK); | |
1035 Expect(Token::RPAREN, CHECK_OK); | 1033 Expect(Token::RPAREN, CHECK_OK); |
1036 { | 1034 { |
1037 // TODO(adamk): Make this CATCH_SCOPE | |
1038 Scope* with_scope = NewScope(scope_, WITH_SCOPE); | 1035 Scope* with_scope = NewScope(scope_, WITH_SCOPE); |
1039 BlockState block_state(&scope_, with_scope); | 1036 BlockState block_state(&scope_, with_scope); |
1040 ParseBlock(CHECK_OK); | 1037 ParseBlock(CHECK_OK); |
1041 } | 1038 } |
1042 tok = peek(); | 1039 tok = peek(); |
1043 } | 1040 } |
1044 if (tok == Token::FINALLY) { | 1041 if (tok == Token::FINALLY) { |
1045 Consume(Token::FINALLY); | 1042 Consume(Token::FINALLY); |
1046 ParseBlock(CHECK_OK); | 1043 ParseBlock(CHECK_OK); |
1047 } | 1044 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 Expect(Token::RBRACE, CHECK_OK); | 1254 Expect(Token::RBRACE, CHECK_OK); |
1258 return PreParserExpression::Default(); | 1255 return PreParserExpression::Default(); |
1259 } | 1256 } |
1260 } | 1257 } |
1261 | 1258 |
1262 #undef CHECK_OK | 1259 #undef CHECK_OK |
1263 | 1260 |
1264 | 1261 |
1265 } // namespace internal | 1262 } // namespace internal |
1266 } // namespace v8 | 1263 } // namespace v8 |
OLD | NEW |