tor-browser

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

obj-prop-elem-target-obj-literal-prop-ref-init.js (3372B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref-init.case
      3 // - src/dstr-assignment/default/for-of.template
      4 /*---
      5 description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with initializer. (For..of statement)
      6 esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
      7 features: [destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    IterationStatement :
     11      for ( LeftHandSideExpression of AssignmentExpression ) Statement
     12 
     13    1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
     14       AssignmentExpression, iterate).
     15    2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
     16       keyResult, assignment, labelSet).
     17 
     18    13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
     19 
     20    [...]
     21    4. If destructuring is true and if lhsKind is assignment, then
     22       a. Assert: lhs is a LeftHandSideExpression.
     23       b. Let assignmentPattern be the parse of the source text corresponding to
     24          lhs using AssignmentPattern as the goal symbol.
     25    [...]
     26 
     27    Syntax
     28 
     29    AssignmentPattern : ObjectAssignmentPattern
     30    ObjectAssignmentPattern : { AssignmentPropertyList }
     31    AssignmentPropertyList : AssignmentProperty
     32    AssignmentProperty : PropertyName : AssignmentElement
     33    AssignmentElement : DestructuringAssignmentTarget Initializer_opt
     34    DestructuringAssignmentTarget : LeftHandSideExpression
     35 
     36    Static Semantics: Early Errors
     37 
     38    DestructuringAssignmentTarget : LeftHandSideExpression
     39 
     40    - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
     41    - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
     42 
     43    Runtime Semantics: DestructuringAssignmentEvaluation
     44    ObjectAssignmentPattern : { AssignmentPropertyList }
     45 
     46    1. Perform ? RequireObjectCoercible(value).
     47    2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument.
     48    3. Return NormalCompletion(empty).
     49 
     50    Runtime Semantics: PropertyDestructuringAssignmentEvaluation
     51 
     52    AssignmentProperty : PropertyName : AssignmentElement
     53 
     54    1. Let name be the result of evaluating PropertyName.
     55    2. ReturnIfAbrupt(name).
     56    3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments.
     57    4. Return a new List containing name.
     58 
     59    Runtime Semantics: KeyedDestructuringAssignmentEvaluation
     60 
     61    AssignmentElement : DestructuringAssignmentTarget Initializer
     62 
     63    1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
     64      a. Let lref be the result of evaluating DestructuringAssignmentTarget.
     65    ...
     66 
     67 ---*/
     68 var setValue;
     69 
     70 var counter = 0;
     71 
     72 for ({ x: {
     73  get y() {
     74    throw new Test262Error('The property should not be accessed.');
     75  },
     76  set y(val) {
     77    setValue = val;
     78  }
     79 }.y = 42} of [{x: 23}]) {
     80  assert.sameValue(setValue, 23);
     81 
     82  counter += 1;
     83 }
     84 
     85 assert.sameValue(counter, 1);
     86 
     87 reportCompare(0, 0);