StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name
https://bugs.webkit.org/show_bug.cgi?id=79571
Patch by Yusuke Suzuki <utatane.tea@gmail.com> on 2012-02-26
Reviewed by Gavin Barraclough.
Source/JavaScriptCore:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createGetterOrSetterProperty):
* parser/Parser.cpp:
(JSC::::parseProperty):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createGetterOrSetterProperty):
LayoutTests:
* fast/js/property-getters-and-setters-expected.txt:
* fast/js/script-tests/property-getters-and-setters.js:
(o9.string_appeared_here.7.get string_appeared_here):
(o9.set string_appeared_here):
(get shouldBe):
(o10.string_appeared_here.7.get 42):
(o10.set 42):
* platform/chromium/fast/js/property-getters-and-setters-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/parser/SyntaxChecker.h b/Source/JavaScriptCore/parser/SyntaxChecker.h
index 32cbf7d..c2c9375 100644
--- a/Source/JavaScriptCore/parser/SyntaxChecker.h
+++ b/Source/JavaScriptCore/parser/SyntaxChecker.h
@@ -210,6 +210,12 @@
return Property(type);
return Property(name, type);
}
+ template <bool strict> Property createGetterOrSetterProperty(JSGlobalData* globalData, int, PropertyNode::Type type, double name, int, int, int, int, int, int)
+ {
+ if (!strict)
+ return Property(type);
+ return Property(&globalData->parserArena->identifierArena().makeNumericIdentifier(globalData, name), type);
+ }
void appendStatement(int, int) { }
void addVar(const Identifier*, bool) { }