Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/parser/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  arrow-rest.js   Sprache: JAVA

 
// The parser should throw SyntaxError immediately if it finds "..." in a
// context where it's not allowed.

function testThrow(code, column) {
  var caught = false;
  try {
    eval(code);
  } catch (e) {
    caught = true;
    assertEq(e.columnNumber, column);
  }
  assertEq(caught, true,
           "failed to throw evaluating <" + code + ">");
}

// expression statement

testThrow(`
...a)=>
`, 1);

// default parameter

testThrow(`
function f(x=...a) =>
`, 14);

// rest parameter

testThrow(`
function f(... ...a) =>
`, 16);

// destructuring parameter

testThrow(`
([... ...a)=>
`, 7);

testThrow(`
({...a)=>
`, 7);

testThrow(`
function f([... ...a)=>
`, 17);

testThrow(`
function f({...a)=>
`, 17);

// arrow

testThrow(`
x => ...a)=>
`, 6);

// template literal

testThrow("`${ ...a)=>}`", 5);

// destructing assignment

testThrow(`
var [... ...a)=>
`, 10);

testThrow(`
var {...a)=>
`, 10);

// initializer

testThrow(`
var [a] = ...a)=>
`, 11);

testThrow(`
var {a:a} = ...a)=>
`, 13);

testThrow(`
var a = ...a)=>
`, 9);

// if statement

testThrow(`
if (...a) =>
`, 5);

// for statement

testThrow(`
for (...a)=>
`, 6);

testThrow(`
for (let a in ...a)=>
`, 15);

testThrow(`
for (let a of ...a)=>
`, 15);

testThrow(`
for (; ...a)=>
`, 8);

testThrow(`
for (;; ...a)=>
`, 9);

// case

testThrow(`
switch (x) { case ...a)=>
`, 19);

// return statement

testThrow(`
function f(x) { return ...a)=>
`, 24);

// yield expression

testThrow(`
function* f(x) { yield ...a)=>
`, 24);

// throw statement

testThrow(`
throw ...a) =>
`, 7);

// class

testThrow(`
class A extends ...a) =>
`, 17);

// conditional expression

testThrow(`
1 ? ...a) =>
`, 5);

testThrow(`
1 ? 2 : ...a) =>
`, 9);

// unary operators

testThrow(`
void ...a) =>
`, 6);

testThrow(`
typeof ...a) =>
`, 8);

testThrow(`
++ ...a) =>
`, 4);

testThrow(`
delete ...a) =>
`, 8);

// new

testThrow(`
new ...a) =>
`, 5);

// member expression

testThrow(`
x[...a) =>
`, 3);

// array literal

testThrow(`
[... ...a) =>
`, 6);

// object literal

testThrow(`
({[...a) =>
`, 4);

testThrow(`
({x: ...a) =>
`, 6);

// assignment

testThrow(`
x = ...a) =>
`, 5);

Messung V0.5
C=89 H=71 G=80

¤ Dauer der Verarbeitung: 0.22 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.