tor-browser

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

static-init-arguments-functions.js (1294B)


      1 // Copyright (C) 2021 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-class-definitions-static-semantics-early-errors
      5 description: The identifier `arguments` is not restricted within function forms
      6 info: |
      7  ClassStaticBlockBody : ClassStaticBlockStatementList
      8 
      9  - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList
     10    is true.
     11 includes: [compareArray.js]
     12 features: [class-static-block]
     13 ---*/
     14 
     15 var fn, fnParam;
     16 var gen, genParam;
     17 var asyncFn, asyncFnParam;
     18 
     19 class C {
     20  static {
     21    (function({test262 = fnParam = arguments}) {
     22      fn = arguments;
     23    })('function');
     24 
     25    (function * ({test262 = genParam = arguments}) {
     26      gen = arguments;
     27    })('generator function').next();
     28 
     29    (async function ({test262 = asyncFnParam = arguments}) {
     30      asyncFn = arguments;
     31    })('async function');
     32  }
     33 }
     34 
     35 assert.compareArray(['function'], fn, 'body');
     36 assert.compareArray(['function'], fnParam, 'parameter');
     37 assert.compareArray(['generator function'], gen, 'body');
     38 assert.compareArray(['generator function'], genParam, 'parameter');
     39 assert.compareArray(['async function'], asyncFn, 'body');
     40 assert.compareArray(['async function'], asyncFnParam, 'parameter');
     41 
     42 reportCompare(0, 0);