OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 *ok = false; | 1529 *ok = false; |
1530 return; | 1530 return; |
1531 } | 1531 } |
1532 strict_mode_violation_location_ = location; | 1532 strict_mode_violation_location_ = location; |
1533 strict_mode_violation_type_ = type; | 1533 strict_mode_violation_type_ = type; |
1534 } | 1534 } |
1535 | 1535 |
1536 | 1536 |
1537 PreParser::Identifier PreParser::ParseIdentifierName(bool* ok) { | 1537 PreParser::Identifier PreParser::ParseIdentifierName(bool* ok) { |
1538 Token::Value next = Next(); | 1538 Token::Value next = Next(); |
1539 if (Token::IsKeyword(next)) { | 1539 if (next != Token::IDENTIFIER && |
1540 int pos = position(); | 1540 next != Token::FUTURE_RESERVED_WORD && |
1541 const char* keyword = Token::String(next); | 1541 next != Token::FUTURE_STRICT_RESERVED_WORD && |
1542 log_->LogAsciiSymbol(pos, Vector<const char>(keyword, StrLength(keyword))); | 1542 !Token::IsKeyword(next)) { |
| 1543 ReportUnexpectedToken(next); |
| 1544 *ok = false; |
1543 return Identifier::Default(); | 1545 return Identifier::Default(); |
1544 } | 1546 } |
1545 if (next == Token::IDENTIFIER || | 1547 return GetIdentifierSymbol(); |
1546 next == Token::FUTURE_RESERVED_WORD || | |
1547 next == Token::FUTURE_STRICT_RESERVED_WORD) { | |
1548 return GetIdentifierSymbol(); | |
1549 } | |
1550 *ok = false; | |
1551 return Identifier::Default(); | |
1552 } | 1548 } |
1553 | 1549 |
1554 #undef CHECK_OK | 1550 #undef CHECK_OK |
1555 | 1551 |
1556 | 1552 |
1557 // This function reads an identifier and determines whether or not it | 1553 // This function reads an identifier and determines whether or not it |
1558 // is 'get' or 'set'. | 1554 // is 'get' or 'set'. |
1559 PreParser::Identifier PreParser::ParseIdentifierNameOrGetOrSet(bool* is_get, | 1555 PreParser::Identifier PreParser::ParseIdentifierNameOrGetOrSet(bool* is_get, |
1560 bool* is_set, | 1556 bool* is_set, |
1561 bool* ok) { | 1557 bool* ok) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 ASSERT(IsAccessorAccessorConflict(old_type, type)); | 1593 ASSERT(IsAccessorAccessorConflict(old_type, type)); |
1598 // Both accessors of the same type. | 1594 // Both accessors of the same type. |
1599 parser()->ReportMessageAt(scanner()->location(), | 1595 parser()->ReportMessageAt(scanner()->location(), |
1600 "accessor_get_set"); | 1596 "accessor_get_set"); |
1601 } | 1597 } |
1602 *ok = false; | 1598 *ok = false; |
1603 } | 1599 } |
1604 } | 1600 } |
1605 | 1601 |
1606 } } // v8::internal | 1602 } } // v8::internal |
OLD | NEW |