tor-browser

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

switch-case-decl-strict-strict.js (673B)


      1 'use strict';
      2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 description: AnnexB extension not honored in strict mode (Function declaration in the `case` clause of a `switch` statement in the global scope)
      6 es6id: B.3.3.2
      7 flags: [onlyStrict]
      8 info: |
      9    B.3.3.2 Changes to GlobalDeclarationInstantiation
     10 
     11    1. 1. Let strict be IsStrict of script
     12    2. If strict is *false*, then
     13       [...]
     14 ---*/
     15 
     16 assert.throws(ReferenceError, function() {
     17  f;
     18 });
     19 
     20 switch (1) {
     21  case 1:
     22    function f() {  }
     23 }
     24 
     25 assert.throws(ReferenceError, function() {
     26  f;
     27 });
     28 
     29 reportCompare(0, 0);