tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

obj-rest-computed-property-no-strict.js (1366B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-assignment/obj-rest-computed-property-no-strict.case
      3 // - src/dstr-assignment/default/assignment-expr.template
      4 /*---
      5 description: Destructuring field can be a computed property, i.e it can be defined only at runtime. Rest operantion needs to skip these properties as well. (AssignmentExpression)
      6 esid: sec-variable-statement-runtime-semantics-evaluation
      7 features: [object-rest, destructuring-binding]
      8 flags: [generated, noStrict]
      9 includes: [propertyHelper.js]
     10 info: |
     11    VariableDeclaration : BindingPattern Initializer
     12 
     13    1. Let rhs be the result of evaluating Initializer.
     14    2. Let rval be GetValue(rhs).
     15    3. ReturnIfAbrupt(rval).
     16    4. Return the result of performing BindingInitialization for
     17       BindingPattern passing rval and undefined as arguments.
     18 ---*/
     19 var a = "foo";
     20 
     21 var result;
     22 var vals = { foo: 1, bar: 2, baz: 3 };
     23 
     24 result = {[a]:b, ...rest} = vals;
     25 
     26 assert.sameValue(b, 1);
     27 assert.sameValue(rest.bar, 2);
     28 assert.sameValue(rest.baz, 3);
     29 
     30 assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined);
     31 
     32 verifyProperty(rest, "bar", {
     33  enumerable: true,
     34  writable: true,
     35  configurable: true
     36 });
     37 
     38 verifyProperty(rest, "baz", {
     39  enumerable: true,
     40  writable: true,
     41  configurable: true
     42 });
     43 
     44 
     45 assert.sameValue(result, vals);
     46 
     47 reportCompare(0, 0);