Changeset 108935 in webkit
- Timestamp:
- Feb 26, 2012 2:51:38 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r108933 r108935 1 2012-02-26 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name 4 https://bugs.webkit.org/show_bug.cgi?id=79571 5 6 Reviewed by Gavin Barraclough. 7 8 * fast/js/property-getters-and-setters-expected.txt: 9 * fast/js/script-tests/property-getters-and-setters.js: 10 (o9.string_appeared_here.7.get string_appeared_here): 11 (o9.set string_appeared_here): 12 (get shouldBe): 13 (o10.string_appeared_here.7.get 42): 14 (o10.set 42): 15 * platform/chromium/fast/js/property-getters-and-setters-expected.txt: 16 1 17 2012-02-26 Sheriff Bot <webkit.review.bot@gmail.com> 2 18 -
trunk/LayoutTests/fast/js/property-getters-and-setters-expected.txt
r107956 r108935 31 31 PASS o8.numSets is 0 32 32 PASS typeof testObj.getter is 'string' 33 the get set with string property name 34 PASS o9.b is 8 35 PASS o9.b is 11 36 the get set with numeric property name 37 PASS o10[42] is 8 38 PASS o10[42] is 11 33 39 PASS successfullyParsed is true 34 40 -
trunk/LayoutTests/fast/js/script-tests/property-getters-and-setters.js
r107956 r108935 68 68 testObj=({get getter(){return 'getter was called.'}, b: 'bar'}) 69 69 shouldBe("typeof testObj.getter", "'string'"); 70 71 debug("the get set with string property name"); 72 var o9 = { 'a':7, get 'b'() { return this.a + 1 }, set 'b'(x) { this.a = x } } 73 shouldBe("o9.b", "8"); 74 o9.b = 10; 75 shouldBe("o9.b", "11"); 76 77 debug("the get set with numeric property name"); 78 var o10 = { 'a':7, get 42() { return this.a + 1 }, set 42(x) { this.a = x } } 79 shouldBe("o10[42]", "8"); 80 o10[42] = 10; 81 shouldBe("o10[42]", "11"); -
trunk/LayoutTests/platform/chromium/fast/js/property-getters-and-setters-expected.txt
r107962 r108935 31 31 PASS o8.numSets is 0 32 32 PASS typeof testObj.getter is 'string' 33 the get set with string property name 34 PASS o9.b is 8 35 PASS o9.b is 11 36 the get set with numeric property name 37 PASS o10[42] is 8 38 PASS o10[42] is 11 33 39 PASS successfullyParsed is true 34 40 -
trunk/Source/JavaScriptCore/ChangeLog
r108934 r108935 1 2012-02-26 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name 4 https://bugs.webkit.org/show_bug.cgi?id=79571 5 6 Reviewed by Gavin Barraclough. 7 8 * parser/ASTBuilder.h: 9 (JSC::ASTBuilder::createGetterOrSetterProperty): 10 * parser/Parser.cpp: 11 (JSC::::parseProperty): 12 * parser/SyntaxChecker.h: 13 (JSC::SyntaxChecker::createGetterOrSetterProperty): 14 1 15 2012-02-26 Mark Hahnenberg <mhahnenberg@apple.com> 2 16 -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r108233 r108935 277 277 } 278 278 279 template <bool> PropertyNode* createGetterOrSetterProperty(JSGlobalData*, int lineNumber, PropertyNode::Type type, double name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) 280 { 281 body->setLoc(bodyStartLine, bodyEndLine); 282 return new (m_globalData) PropertyNode(m_globalData, name, new (m_globalData) FuncExprNode(lineNumber, m_globalData->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), params), type); 283 } 279 284 280 285 ArgumentsNode* createArguments() { return new (m_globalData) ArgumentsNode(); } -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r108259 r108935 1205 1205 } 1206 1206 failIfFalse(wasIdent); 1207 matchOrFail(IDENT);1208 1207 const Identifier* accessorName = 0; 1209 1208 TreeFormalParameterList parameters = 0; … … 1219 1218 else 1220 1219 fail(); 1221 failIfFalse((parseFunctionInfo<FunctionNeedsName, false>(context, accessorName, parameters, body, openBracePos, closeBracePos, bodyStartLine))); 1222 return context.template createGetterOrSetterProperty<complete>(m_lexer->lastLineNumber(), type, accessorName, parameters, body, openBracePos, closeBracePos, bodyStartLine, m_lastLine); 1220 const Identifier* stringPropertyName = 0; 1221 double numericPropertyName = 0; 1222 if (m_token.m_type == IDENT || m_token.m_type == STRING) 1223 stringPropertyName = m_token.m_data.ident; 1224 else if (m_token.m_type == NUMBER) 1225 numericPropertyName = m_token.m_data.doubleValue; 1226 else 1227 fail(); 1228 next(); 1229 failIfFalse((parseFunctionInfo<FunctionNoRequirements, false>(context, accessorName, parameters, body, openBracePos, closeBracePos, bodyStartLine))); 1230 if (stringPropertyName) 1231 return context.template createGetterOrSetterProperty<complete>(m_lexer->lastLineNumber(), type, stringPropertyName, parameters, body, openBracePos, closeBracePos, bodyStartLine, m_lastLine); 1232 return context.template createGetterOrSetterProperty<complete>(const_cast<JSGlobalData*>(m_globalData), m_lexer->lastLineNumber(), type, numericPropertyName, parameters, body, openBracePos, closeBracePos, bodyStartLine, m_lastLine); 1223 1233 } 1224 1234 case NUMBER: { -
trunk/Source/JavaScriptCore/parser/SyntaxChecker.h
r106512 r108935 211 211 return Property(name, type); 212 212 } 213 template <bool strict> Property createGetterOrSetterProperty(JSGlobalData* globalData, int, PropertyNode::Type type, double name, int, int, int, int, int, int) 214 { 215 if (!strict) 216 return Property(type); 217 return Property(&globalData->parserArena->identifierArena().makeNumericIdentifier(globalData, name), type); 218 } 213 219 214 220 void appendStatement(int, int) { }
Note: See TracChangeset
for help on using the changeset viewer.