[Webkit-unassigned] [Bug 142943] New: ES6: Computed Properties should always produce string keys, not numeric indexes
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Mar 21 18:51:08 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=142943
Bug ID: 142943
Summary: ES6: Computed Properties should always produce string
keys, not numeric indexes
Classification: Unclassified
Product: WebKit
Version: 528+ (Nightly build)
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: joepeck at webkit.org
CC: ggaren at apple.com
* SUMMARY
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-evaluation
> Runtime Semantics: Evaluation
>
> ComputedPropertyName : [ AssignmentExpression ]
> Let exprValue be the result of evaluating AssignmentExpression.
> Let propName be GetValue(exprValue).
> ReturnIfAbrupt(propName).
> Return ToPropertyKey(propName).
> ---
>
> ToPropertyKey ( argument )
>
> The abstract operation ToPropertyKey converts argument to a value that can
> be used as a property key by performing the following steps:
>
> Let key be ToPrimitive(argument, hint String).
> ReturnIfAbrupt(key).
> If Type(key) is Symbol, then
> Return key.
> Return ToString(key).
* TEST (LayoutTests/js/script-tests/basic-computed-property-name.js)
var a = 0;
runTest("{[a]: true, get '0'(){ return false; }}[0])")
As written, this should actually be `false`, but currently it is `true`.
It seems we are treating the index key as an index instead of a string, and it goes down a different path.
* NOTES
- Firefox behaves correctly here
- Chrome does not currently have computed properties
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150322/c7e859f9/attachment-0002.html>
More information about the webkit-unassigned
mailing list