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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 bool done = (peek() == Token::RPAREN); | 2317 bool done = (peek() == Token::RPAREN); |
2318 while (!done) { | 2318 while (!done) { |
2319 ExpressionT argument = this->ParseAssignmentExpression( | 2319 ExpressionT argument = this->ParseAssignmentExpression( |
2320 true, CHECK_OK_CUSTOM(NullExpressionList)); | 2320 true, CHECK_OK_CUSTOM(NullExpressionList)); |
2321 result->Add(argument, zone_); | 2321 result->Add(argument, zone_); |
2322 if (result->length() > Code::kMaxArguments) { | 2322 if (result->length() > Code::kMaxArguments) { |
2323 ReportMessage("too_many_arguments"); | 2323 ReportMessage("too_many_arguments"); |
2324 *ok = false; | 2324 *ok = false; |
2325 return this->NullExpressionList(); | 2325 return this->NullExpressionList(); |
2326 } | 2326 } |
2327 done = (peek() == Token::RPAREN); | 2327 done = (peek() != Token::COMMA); |
2328 if (!done) { | 2328 if (!done) { |
2329 // Need {} because of the CHECK_OK_CUSTOM macro. | 2329 Next(); |
2330 Expect(Token::COMMA, CHECK_OK_CUSTOM(NullExpressionList)); | |
2331 } | 2330 } |
2332 } | 2331 } |
2333 Expect(Token::RPAREN, CHECK_OK_CUSTOM(NullExpressionList)); | 2332 Scanner::Location location = scanner_->location(); |
| 2333 if (Token::RPAREN != Next()) { |
| 2334 ReportMessageAt(location, "unterminated_arg_list"); |
| 2335 *ok = false; |
| 2336 return this->NullExpressionList(); |
| 2337 } |
2334 return result; | 2338 return result; |
2335 } | 2339 } |
2336 | 2340 |
2337 // Precedence = 2 | 2341 // Precedence = 2 |
2338 template <class Traits> | 2342 template <class Traits> |
2339 typename ParserBase<Traits>::ExpressionT | 2343 typename ParserBase<Traits>::ExpressionT |
2340 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, bool* ok) { | 2344 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, bool* ok) { |
2341 // AssignmentExpression :: | 2345 // AssignmentExpression :: |
2342 // ConditionalExpression | 2346 // ConditionalExpression |
2343 // ArrowFunction | 2347 // ArrowFunction |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 *ok = false; | 3153 *ok = false; |
3150 return; | 3154 return; |
3151 } | 3155 } |
3152 has_seen_constructor_ = true; | 3156 has_seen_constructor_ = true; |
3153 return; | 3157 return; |
3154 } | 3158 } |
3155 } | 3159 } |
3156 } } // v8::internal | 3160 } } // v8::internal |
3157 | 3161 |
3158 #endif // V8_PREPARSER_H | 3162 #endif // V8_PREPARSER_H |
OLD | NEW |