Changeset 188498 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- Aug 14, 2015, 4:50:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r188417 r188498 1962 1962 // FIXME: Figure out a way to share more code with parseProperty. 1963 1963 const CommonIdentifiers& propertyNames = *m_vm->propertyNames; 1964 const Identifier* ident = nullptr; 1964 const Identifier* ident = &propertyNames.nullIdentifier; 1965 TreeExpression computedPropertyName = 0; 1965 1966 bool isGetter = false; 1966 1967 bool isSetter = false; … … 1986 1987 next(); 1987 1988 break; 1989 case OPENBRACKET: 1990 next(); 1991 computedPropertyName = parseAssignmentExpression(context); 1992 failIfFalse(computedPropertyName, "Cannot parse computed property name"); 1993 handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name"); 1994 break; 1988 1995 default: 1989 1996 failDueToUnexpectedToken(); … … 2000 2007 bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor; 2001 2008 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method"); 2002 failIfTrue(! ident ||(declareVariable(ident) & DeclarationResult::InvalidStrictMode), "Cannot declare a method named '", methodInfo.name->impl(), "'");2009 failIfTrue(!computedPropertyName && (declareVariable(ident) & DeclarationResult::InvalidStrictMode), "Cannot declare a method named '", methodInfo.name->impl(), "'"); 2003 2010 methodInfo.name = isConstructor ? className : ident; 2004 2011 … … 2013 2020 semanticFailIfTrue(isStaticMethod && methodInfo.name && *methodInfo.name == propertyNames.prototype, 2014 2021 "Cannot declare a static method named 'prototype'"); 2015 property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed); 2022 if (computedPropertyName) { 2023 property = context.createProperty(computedPropertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), 2024 PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed); 2025 } else 2026 property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed); 2016 2027 } 2017 2028
Note:
See TracChangeset
for help on using the changeset viewer.