archives

« Bugzilla Issues Index

#1815 — Computed property names in BindingProperty


The grammar allows:

var n = 'y';
var {[n]: x} = {y: 42};

I believe the semantics does not cover this case.


I think it does. http://people.mozilla.org/~jorendorff/es6-draft.html#sec-13.2.3.2

Binding Initialisation

BindingProperty : PropertyName : BindingElement

1. Let P be the result of evaluating PropertyName
2. ReturnIfAbrupt(P).
3. Return the result of performing Keyed Binding Initialisation for BindingElement using value, environment, and P as arguments.

and http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.1.5

PropertyName : ComputedPropertyName

Evaluation

ComputedPropertyName : [ AssignmentExpression ]

1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be GetValue(exprValue).
3. ReturnIfAbrupt(propName).
4. Return ToPropertyKey(propName).


Looks like you got it covered.