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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 | 2020 |
2021 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( | 2021 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( |
2022 name, scanner()->location(), | 2022 name, scanner()->location(), |
2023 false, // reserved words are allowed here | 2023 false, // reserved words are allowed here |
2024 FunctionKind::kNormalFunction, RelocInfo::kNoPosition, | 2024 FunctionKind::kNormalFunction, RelocInfo::kNoPosition, |
2025 FunctionLiteral::ANONYMOUS_EXPRESSION, | 2025 FunctionLiteral::ANONYMOUS_EXPRESSION, |
2026 is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY, | 2026 is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY, |
2027 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2027 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
2028 return factory()->NewObjectLiteralProperty(is_get, value, next_pos, | 2028 return factory()->NewObjectLiteralProperty(is_get, value, next_pos, |
2029 is_static); | 2029 is_static); |
| 2030 |
| 2031 } else if (!in_class && allow_harmony_object_literals_ && |
| 2032 Token::IsIdentifier(name_token, strict_mode(), |
| 2033 this->is_generator())) { |
| 2034 value = this->ExpressionFromIdentifier(name, next_pos, scope_, factory()); |
| 2035 |
2030 } else { | 2036 } else { |
2031 Token::Value next = Next(); | 2037 Token::Value next = Next(); |
2032 ReportUnexpectedToken(next); | 2038 ReportUnexpectedToken(next); |
2033 *ok = false; | 2039 *ok = false; |
2034 return this->EmptyObjectLiteralProperty(); | 2040 return this->EmptyObjectLiteralProperty(); |
2035 } | 2041 } |
2036 | 2042 |
2037 uint32_t index; | 2043 uint32_t index; |
2038 LiteralT key = this->IsArrayIndex(name, &index) | 2044 LiteralT key = this->IsArrayIndex(name, &index) |
2039 ? factory()->NewNumberLiteral(index, next_pos) | 2045 ? factory()->NewNumberLiteral(index, next_pos) |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2835 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
2830 // Both accessors of the same type. | 2836 // Both accessors of the same type. |
2831 parser()->ReportMessage("accessor_get_set"); | 2837 parser()->ReportMessage("accessor_get_set"); |
2832 } | 2838 } |
2833 *ok = false; | 2839 *ok = false; |
2834 } | 2840 } |
2835 } | 2841 } |
2836 } } // v8::internal | 2842 } } // v8::internal |
2837 | 2843 |
2838 #endif // V8_PREPARSER_H | 2844 #endif // V8_PREPARSER_H |
OLD | NEW |