tor-browser

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

cptn-no-dflt-no-match.js (1396B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 13.12.11
      5 description: Completion value when no cases match
      6 info: |
      7    SwitchStatement : switch ( Expression ) CaseBlock
      8 
      9    [...]
     10    8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
     11       argument switchValue.
     12    9. Set the running execution context’s LexicalEnvironment to oldEnv.
     13    10. Return R.
     14 
     15    13.12.9 Runtime Semantics: CaseBlockEvaluation
     16 
     17    CaseBlock : { CaseClauses }
     18 
     19    1. Let V = undefined.
     20    2. Let A be the List of CaseClause items in CaseClauses, in source text
     21       order.
     22    3. Let found be false.
     23    4. Repeat for each CaseClause C in A,
     24       a. If found is false, then
     25          i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
     26          ii. If clauseSelector is an abrupt completion, then
     27              [...]
     28          iii. Let found be the result of performing Strict Equality Comparison
     29               input === clauseSelector.[[value]].
     30       b. If found is true, then
     31          [...]
     32    5. Return NormalCompletion(V).
     33 ---*/
     34 
     35 assert.sameValue(
     36  eval('1; switch ("a") { case null: }'), undefined, 'empty StatementList'
     37 );
     38 assert.sameValue(
     39  eval('2; switch ("a") { case null: 3; }'),
     40  undefined,
     41  'non-empty StatementList'
     42 );
     43 
     44 reportCompare(0, 0);