« 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.

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.


PropertyName : ComputedPropertyName


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.