| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 #undef CHECK_OK_CUSTOM | 1542 #undef CHECK_OK_CUSTOM |
| 1543 | 1543 |
| 1544 | 1544 |
| 1545 template <typename Traits> | 1545 template <typename Traits> |
| 1546 void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty( | 1546 void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty( |
| 1547 Token::Value property, | 1547 Token::Value property, |
| 1548 PropertyKind type, | 1548 PropertyKind type, |
| 1549 bool* ok) { | 1549 bool* ok) { |
| 1550 int old; | 1550 int old; |
| 1551 if (property == Token::NUMBER) { | 1551 if (property == Token::NUMBER) { |
| 1552 old = finder_.AddNumber(scanner()->literal_one_byte_string(), type); | 1552 old = scanner()->FindNumber(&finder_, type); |
| 1553 } else if (scanner()->is_literal_one_byte()) { | |
| 1554 old = finder_.AddAsciiSymbol(scanner()->literal_one_byte_string(), type); | |
| 1555 } else { | 1553 } else { |
| 1556 old = finder_.AddUtf16Symbol(scanner()->literal_utf16_string(), type); | 1554 old = scanner()->FindSymbol(&finder_, type); |
| 1557 } | 1555 } |
| 1558 PropertyKind old_type = static_cast<PropertyKind>(old); | 1556 PropertyKind old_type = static_cast<PropertyKind>(old); |
| 1559 if (HasConflict(old_type, type)) { | 1557 if (HasConflict(old_type, type)) { |
| 1560 if (IsDataDataConflict(old_type, type)) { | 1558 if (IsDataDataConflict(old_type, type)) { |
| 1561 // Both are data properties. | 1559 // Both are data properties. |
| 1562 if (strict_mode_ == SLOPPY) return; | 1560 if (strict_mode_ == SLOPPY) return; |
| 1563 parser()->ReportMessageAt(scanner()->location(), | 1561 parser()->ReportMessageAt(scanner()->location(), |
| 1564 "strict_duplicate_property"); | 1562 "strict_duplicate_property"); |
| 1565 } else if (IsDataAccessorConflict(old_type, type)) { | 1563 } else if (IsDataAccessorConflict(old_type, type)) { |
| 1566 // Both a data and an accessor property with the same name. | 1564 // Both a data and an accessor property with the same name. |
| 1567 parser()->ReportMessageAt(scanner()->location(), | 1565 parser()->ReportMessageAt(scanner()->location(), |
| 1568 "accessor_data_property"); | 1566 "accessor_data_property"); |
| 1569 } else { | 1567 } else { |
| 1570 ASSERT(IsAccessorAccessorConflict(old_type, type)); | 1568 ASSERT(IsAccessorAccessorConflict(old_type, type)); |
| 1571 // Both accessors of the same type. | 1569 // Both accessors of the same type. |
| 1572 parser()->ReportMessageAt(scanner()->location(), | 1570 parser()->ReportMessageAt(scanner()->location(), |
| 1573 "accessor_get_set"); | 1571 "accessor_get_set"); |
| 1574 } | 1572 } |
| 1575 *ok = false; | 1573 *ok = false; |
| 1576 } | 1574 } |
| 1577 } | 1575 } |
| 1578 | 1576 |
| 1579 | 1577 |
| 1580 } } // v8::internal | 1578 } } // v8::internal |
| 1581 | 1579 |
| 1582 #endif // V8_PREPARSER_H | 1580 #endif // V8_PREPARSER_H |
| OLD | NEW |