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

Quelle  letContextualKeyword.js

  Sprache: JAVA
 

function expectError(str) {
  var log = "";
  try {
    eval(str);
  } catch (e) {
    log += "e";
    assertEq(e instanceof SyntaxError, true);
  }
  assertEq(log, "e");
}

eval(`let x = 42; assertEq(x, 42);`);
eval(`var let = 42; assertEq(let, 42);`);
eval(`let;`);
eval(`[...let] = [];`);
eval(`function let() { return 42; } assertEq(let(), 42);`)
eval(`let {x:x} = {x:42}; assertEq(x, 42);`);
eval(`let [x] = [42]; assertEq(x, 42);`);

eval(`for (let x in [1]) { assertEq(x, "0"); }`);
eval(`for (const x in [1]) { assertEq(x, "0"); }`);

eval(`for (let x of [1]) { assertEq(x, 1); }`);
eval(`for (const x of [1]) { assertEq(x, 1); }`);

eval(`for (let i = 0; i < 1; i++) { assertEq(i, 0); }`);
eval(`var done = falsefor (const i = 0; !done; done = true) { assertEq(i, 0); }`);

eval(`for (let of of [1]) { assertEq(of, 1); }`);
eval(`for (const of of [1]) { assertEq(of, 1); }`);

eval(`try { throw 17; } catch (let) { assertEq(let, 17); }`);
eval(`try { throw [17]; } catch ([let]) { assertEq(let, 17); }`);
eval(`try { throw { x: 17 }; } catch ({ x: let }) { assertEq(let, 17); }`);
eval(`try { throw {}; } catch ({ x: let = 17 }) { assertEq(let, 17); }`);

expectError(`try { throw [1742]; } catch ([let, let]) {}`);

eval(`for (let in [1]) { assertEq(let, "0"); }`);
eval(`for (let / 1; ; ) { break; }`);
expectError(`let = {}; for (let.x of;;);`);
expectError(`for (let of [1]) { }`);

expectError(`for (let let in [1]) { }`);
expectError(`for (const let in [1]) { }`);

expectError(`for (let let of [1]) { }`);
expectError(`for (const let of [1]) { }`);

expectError(`for (let let = 17false; ) { }`);
expectError(`for (const let = 17false; ) { }`);

expectError(`for (let [let] = 17false; ) { }`);
expectError(`for (const [let] = 17false; ) { }`);

expectError(`for (let [let = 42] = 17false; ) { }`);
expectError(`for (const [let = 42] = 17false; ) { }`);

expectError(`for (let { x: let } = 17false; ) { }`);
expectError(`for (const { x: let } = 17false; ) { }`);

expectError(`for (let { x: let = 42 } = 17false; ) { }`);
expectError(`for (const { x: let = 42 } = 17false; ) { }`);

expectError("let\nlet;");
expectError("const\nlet;");

expectError(`let let = 17;`);
expectError(`const let = 17;`);

expectError(`let [let] = 17;`);
expectError(`const [let] = 17;`);

expectError(`let [let = 42] = 17;`);
expectError(`const [let = 42] = 17;`);

expectError(`let {let} = 17;`);
expectError(`const {let} = 17;`);

expectError(`let { let = 42 } = 17;`);
expectError(`const { let = 42 } = 17;`);

expectError(`let { x: let } = 17;`);
expectError(`const { x: let } = 17;`);

expectError(`let { x: let = 42 } = 17;`);
expectError(`const { x: let = 42 } = 17;`);

expectError(`let { ['y']: let } = 17;`);
expectError(`const { ['y']: let } = 17;`);

expectError(`let { ['y']: let = 42 } = 17;`);
expectError(`const { ['y']: let = 42 } = 17;`);

expectError(`let { x: [let] } = { x: 17 };`);
expectError(`const { x: [let] } = { x: 17 };`);

expectError(`let { x: [let = 42] } = { x: 17 };`);
expectError(`const { x: [let = 42] } = { x: 17 };`);

expectError(`let [foo, let] = 42;`);
expectError(`const [foo, let] = 42;`);

expectError(`let [foo, { let }] = [17, {}];`);
expectError(`const [foo, { let }] = [17, {}];`);

expectError(`"use strict"var let = 42;`);
expectError(`"use strict"function let() {}`);
expectError(`"use strict"for (let of [1]) {}`);
expectError(`"use strict"try {} catch (let) {}`);

Messung V0.5 in Prozent
C=94 H=79 G=86

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.