tor-browser

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

eval-fn-regexp-literal.js (1209B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/statementList/regexp-literal.case
      3 // - src/statementList/default/eval-function-declaration.template
      4 /*---
      5 description: Regular Expression Literal (Eval production of StatementList starting with a Function Declaration)
      6 esid: prod-StatementList
      7 flags: [generated]
      8 info: |
      9    StatementList:
     10      StatementListItem
     11      StatementList StatementListItem
     12 
     13    StatementListItem:
     14      Statement
     15      Declaration
     16 
     17    Declaration:
     18      HoistableDeclaration
     19 
     20    FunctionDeclaration:
     21      function BindingIdentifier ( FormalParameters ) { FunctionBody }
     22 
     23    Statement:
     24      BlockStatement
     25      VariableStatement
     26      EmptyStatement
     27      ExpressionStatement
     28      ...
     29 
     30    ExpressionStatement[Yield, Await]:
     31      [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
     32        Expression ;
     33 
     34    RegularExpressionLiteral ::
     35      / RegularExpressionBody / RegularExpressionFlags
     36 ---*/
     37 
     38 
     39 var result = eval('function fn() {}/1/;');
     40 
     41 assert.sameValue(Object.getPrototypeOf(result), RegExp.prototype);
     42 assert.sameValue(result.flags, '');
     43 assert.sameValue(result.toString(), '/1/');
     44 
     45 reportCompare(0, 0);