tor-browser

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

accessor-name-literal-numeric-non-canonical.js (1207B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/accessor-names/literal-numeric-non-canonical.case
      3 // - src/accessor-names/default/obj.template
      4 /*---
      5 description: Computed values as accessor property names (numeric literal with non-canonical representation) (Object initializer)
      6 esid: sec-object-initializer-runtime-semantics-evaluation
      7 flags: [generated]
      8 info: |
      9    ObjectLiteral :
     10      { PropertyDefinitionList }
     11      { PropertyDefinitionList , }
     12 
     13    1. Let obj be ObjectCreate(%ObjectPrototype%).
     14    2. Let status be the result of performing PropertyDefinitionEvaluation of
     15       PropertyDefinitionList with arguments obj and true.
     16 
     17    12.2.6.7 Runtime Semantics: Evaluation
     18 
     19    [...]
     20 
     21    ComputedPropertyName : [ AssignmentExpression ]
     22 
     23    1. Let exprValue be the result of evaluating AssignmentExpression.
     24    2. Let propName be ? GetValue(exprValue).
     25    3. Return ? ToPropertyKey(propName).
     26 ---*/
     27 
     28 var stringSet;
     29 var obj = {
     30  get [0.0000001]() { return 'get string'; },
     31  set [0.0000001](param) { stringSet = param; }
     32 };
     33 
     34 assert.sameValue(obj['1e-7'], 'get string');
     35 
     36 obj['1e-7'] = 'set string';
     37 assert.sameValue(stringSet, 'set string');
     38 
     39 reportCompare(0, 0);