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 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2310 bool done = (peek() == Token::RPAREN); | 2310 bool done = (peek() == Token::RPAREN); |
2311 while (!done) { | 2311 while (!done) { |
2312 ExpressionT argument = this->ParseAssignmentExpression( | 2312 ExpressionT argument = this->ParseAssignmentExpression( |
2313 true, CHECK_OK_CUSTOM(NullExpressionList)); | 2313 true, CHECK_OK_CUSTOM(NullExpressionList)); |
2314 result->Add(argument, zone_); | 2314 result->Add(argument, zone_); |
2315 if (result->length() > Code::kMaxArguments) { | 2315 if (result->length() > Code::kMaxArguments) { |
2316 ReportMessage("too_many_arguments"); | 2316 ReportMessage("too_many_arguments"); |
2317 *ok = false; | 2317 *ok = false; |
2318 return this->NullExpressionList(); | 2318 return this->NullExpressionList(); |
2319 } | 2319 } |
2320 done = (peek() == Token::RPAREN); | 2320 done = (peek() == Token::RPAREN); |
Yang
2015/03/16 07:24:33
I think it's cleaner and easier to read if we chec
yurys
2015/03/16 08:56:23
Done.
| |
2321 if (!done) { | 2321 if (!done) { |
2322 // Need {} because of the CHECK_OK_CUSTOM macro. | 2322 Scanner::Location location = scanner_->location(); |
2323 Expect(Token::COMMA, CHECK_OK_CUSTOM(NullExpressionList)); | 2323 Token::Value next = Next(); |
2324 if (Token::COMMA != next) { | |
2325 ReportMessageAt(location, "unterminated_arg_list"); | |
2326 *ok = false; | |
2327 return this->NullExpressionList(); | |
2328 } | |
2324 } | 2329 } |
2325 } | 2330 } |
2326 Expect(Token::RPAREN, CHECK_OK_CUSTOM(NullExpressionList)); | 2331 Expect(Token::RPAREN, CHECK_OK_CUSTOM(NullExpressionList)); |
Yang
2015/03/16 07:24:33
... check for Token::LPAREN here, throwing untermi
yurys
2015/03/16 08:56:23
Done.
| |
2327 return result; | 2332 return result; |
2328 } | 2333 } |
2329 | 2334 |
2330 // Precedence = 2 | 2335 // Precedence = 2 |
2331 template <class Traits> | 2336 template <class Traits> |
2332 typename ParserBase<Traits>::ExpressionT | 2337 typename ParserBase<Traits>::ExpressionT |
2333 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, bool* ok) { | 2338 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, bool* ok) { |
2334 // AssignmentExpression :: | 2339 // AssignmentExpression :: |
2335 // ConditionalExpression | 2340 // ConditionalExpression |
2336 // ArrowFunction | 2341 // ArrowFunction |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3135 *ok = false; | 3140 *ok = false; |
3136 return; | 3141 return; |
3137 } | 3142 } |
3138 has_seen_constructor_ = true; | 3143 has_seen_constructor_ = true; |
3139 return; | 3144 return; |
3140 } | 3145 } |
3141 } | 3146 } |
3142 } } // v8::internal | 3147 } } // v8::internal |
3143 | 3148 |
3144 #endif // V8_PREPARSER_H | 3149 #endif // V8_PREPARSER_H |
OLD | NEW |