Changeset 189504 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- Sep 8, 2015, 12:43:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r189431 r189504 1978 1978 ASSERT(ident); 1979 1979 next(); 1980 if (match(IDENT) || match(STRING) || match(DOUBLE) || match(INTEGER) ) {1980 if (match(IDENT) || match(STRING) || match(DOUBLE) || match(INTEGER) || match(OPENBRACKET)) { 1981 1981 isGetter = *ident == propertyNames.get; 1982 1982 isSetter = *ident == propertyNames.set; … … 2911 2911 const Identifier* stringPropertyName = 0; 2912 2912 double numericPropertyName = 0; 2913 if (m_token.m_type == IDENT || m_token.m_type == STRING || isLETMaskedAsIDENT()) { 2913 TreeExpression computedPropertyName = 0; 2914 2915 JSTokenLocation location(tokenLocation()); 2916 2917 if (match(IDENT) || match(STRING) || isLETMaskedAsIDENT()) { 2914 2918 stringPropertyName = m_token.m_data.ident; 2915 2919 semanticFailIfTrue(superBinding == SuperBinding::Needed && *stringPropertyName == m_vm->propertyNames->prototype, … … 2917 2921 semanticFailIfTrue(superBinding == SuperBinding::Needed && *stringPropertyName == m_vm->propertyNames->constructor, 2918 2922 "Cannot declare a getter or setter named 'constructor'"); 2919 } else if (m_token.m_type == DOUBLE || m_token.m_type == INTEGER) 2923 next(); 2924 } else if (match(DOUBLE) || match(INTEGER)) { 2920 2925 numericPropertyName = m_token.m_data.doubleValue; 2921 else 2926 next(); 2927 } else if (match(OPENBRACKET)) { 2928 next(); 2929 computedPropertyName = parseAssignmentExpression(context); 2930 failIfFalse(computedPropertyName, "Cannot parse computed property name"); 2931 handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name"); 2932 } else 2922 2933 failDueToUnexpectedToken(); 2923 JSTokenLocation location(tokenLocation()); 2924 next(); 2934 2925 2935 ParserFunctionInfo<TreeBuilder> info; 2926 2936 if (type & PropertyNode::Getter) { … … 2933 2943 getterOrSetterStartOffset, info, StandardFunctionParseType)), "Cannot parse setter definition"); 2934 2944 } 2945 2935 2946 if (stringPropertyName) 2936 2947 return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, superBinding); 2948 2949 if (computedPropertyName) 2950 return context.createGetterOrSetterProperty(location, static_cast<PropertyNode::Type>(type | PropertyNode::Computed), strict, computedPropertyName, info, superBinding); 2951 2937 2952 return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, strict, numericPropertyName, info, superBinding); 2938 2953 }
Note:
See TracChangeset
for help on using the changeset viewer.