Chromium Code Reviews| 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/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
| (...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1536 | 1536 |
| 1537 | 1537 |
| 1538 template <class Traits> | 1538 template <class Traits> |
| 1539 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral( | 1539 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral( |
| 1540 bool* ok) { | 1540 bool* ok) { |
| 1541 // ObjectLiteral :: | 1541 // ObjectLiteral :: |
| 1542 // '{' (( | 1542 // '{' (( |
| 1543 // ((IdentifierName | String | Number) ':' AssignmentExpression) | | 1543 // ((IdentifierName | String | Number) ':' AssignmentExpression) | |
| 1544 // (('get' | 'set') (IdentifierName | String | Number) FunctionLiteral) | 1544 // (('get' | 'set') (IdentifierName | String | Number) FunctionLiteral) |
| 1545 // ) ',')* '}' | 1545 // ) ',')* '}' |
| 1546 // (Except that trailing comma is not required and not allowed.) | 1546 // (Except that the trailing comma is not required.) |
| 1547 | 1547 |
| 1548 int pos = peek_position(); | 1548 int pos = peek_position(); |
| 1549 typename Traits::Type::PropertyList properties = | 1549 typename Traits::Type::PropertyList properties = |
| 1550 this->NewPropertyList(4, zone_); | 1550 this->NewPropertyList(4, zone_); |
| 1551 int number_of_boilerplate_properties = 0; | 1551 int number_of_boilerplate_properties = 0; |
| 1552 bool has_function = false; | 1552 bool has_function = false; |
| 1553 | 1553 |
| 1554 ObjectLiteralChecker checker(this, strict_mode()); | 1554 ObjectLiteralChecker checker(this, strict_mode()); |
| 1555 | 1555 |
| 1556 Expect(Token::LBRACE, CHECK_OK); | 1556 Expect(Token::LBRACE, CHECK_OK); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1667 // property. (Parser only.) | 1667 // property. (Parser only.) |
| 1668 this->CheckFunctionLiteralInsideTopLevelObjectLiteral(scope_, value, | 1668 this->CheckFunctionLiteralInsideTopLevelObjectLiteral(scope_, value, |
| 1669 &has_function); | 1669 &has_function); |
| 1670 | 1670 |
| 1671 // Count CONSTANT or COMPUTED properties to maintain the enumeration order. | 1671 // Count CONSTANT or COMPUTED properties to maintain the enumeration order. |
| 1672 if (this->IsBoilerplateProperty(property)) { | 1672 if (this->IsBoilerplateProperty(property)) { |
| 1673 number_of_boilerplate_properties++; | 1673 number_of_boilerplate_properties++; |
| 1674 } | 1674 } |
| 1675 properties->Add(property, zone()); | 1675 properties->Add(property, zone()); |
| 1676 | 1676 |
| 1677 // TODO(1240767): Consider allowing trailing comma. | 1677 // TODO(1240767): Consider allowing trailing comma. |
|
marja
2014/06/25 10:04:00
Pls remove this TODO.
| |
| 1678 if (peek() != Token::RBRACE) { | 1678 if (peek() != Token::RBRACE) { |
| 1679 // Need {} because of the CHECK_OK macro. | 1679 // Need {} because of the CHECK_OK macro. |
| 1680 Expect(Token::COMMA, CHECK_OK); | 1680 Expect(Token::COMMA, CHECK_OK); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 if (fni_ != NULL) { | 1683 if (fni_ != NULL) { |
| 1684 fni_->Infer(); | 1684 fni_->Infer(); |
| 1685 fni_->Leave(); | 1685 fni_->Leave(); |
| 1686 } | 1686 } |
| 1687 } | 1687 } |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2207 parser()->ReportMessage("accessor_get_set"); | 2207 parser()->ReportMessage("accessor_get_set"); |
| 2208 } | 2208 } |
| 2209 *ok = false; | 2209 *ok = false; |
| 2210 } | 2210 } |
| 2211 } | 2211 } |
| 2212 | 2212 |
| 2213 | 2213 |
| 2214 } } // v8::internal | 2214 } } // v8::internal |
| 2215 | 2215 |
| 2216 #endif // V8_PREPARSER_H | 2216 #endif // V8_PREPARSER_H |
| OLD | NEW |