OLD | NEW |
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 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 5176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 | 5187 |
5188 Expect(Token::SWITCH, CHECK_OK); | 5188 Expect(Token::SWITCH, CHECK_OK); |
5189 Expect(Token::LPAREN, CHECK_OK); | 5189 Expect(Token::LPAREN, CHECK_OK); |
5190 ExpressionT tag = ParseExpression(true, CHECK_OK); | 5190 ExpressionT tag = ParseExpression(true, CHECK_OK); |
5191 Expect(Token::RPAREN, CHECK_OK); | 5191 Expect(Token::RPAREN, CHECK_OK); |
5192 | 5192 |
5193 auto switch_statement = factory()->NewSwitchStatement(labels, switch_pos); | 5193 auto switch_statement = factory()->NewSwitchStatement(labels, switch_pos); |
5194 | 5194 |
5195 { | 5195 { |
5196 BlockState cases_block_state(zone(), &scope_); | 5196 BlockState cases_block_state(zone(), &scope_); |
5197 scope()->set_start_position(scanner()->location().beg_pos); | 5197 scope()->set_start_position(switch_pos); |
5198 scope()->SetNonlinear(); | 5198 scope()->SetNonlinear(); |
5199 typename Types::Target target(this, switch_statement); | 5199 typename Types::Target target(this, switch_statement); |
5200 | 5200 |
5201 bool default_seen = false; | 5201 bool default_seen = false; |
5202 auto cases = impl()->NewCaseClauseList(4); | 5202 auto cases = impl()->NewCaseClauseList(4); |
5203 Expect(Token::LBRACE, CHECK_OK); | 5203 Expect(Token::LBRACE, CHECK_OK); |
5204 while (peek() != Token::RBRACE) { | 5204 while (peek() != Token::RBRACE) { |
5205 // An empty label indicates the default case. | 5205 // An empty label indicates the default case. |
5206 ExpressionT label = impl()->EmptyExpression(); | 5206 ExpressionT label = impl()->EmptyExpression(); |
5207 if (Check(Token::CASE)) { | 5207 if (Check(Token::CASE)) { |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5804 } | 5804 } |
5805 | 5805 |
5806 #undef CHECK_OK | 5806 #undef CHECK_OK |
5807 #undef CHECK_OK_CUSTOM | 5807 #undef CHECK_OK_CUSTOM |
5808 #undef CHECK_OK_VOID | 5808 #undef CHECK_OK_VOID |
5809 | 5809 |
5810 } // namespace internal | 5810 } // namespace internal |
5811 } // namespace v8 | 5811 } // namespace v8 |
5812 | 5812 |
5813 #endif // V8_PARSING_PARSER_BASE_H | 5813 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |