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

Quelle  location.js

  Sprache: JAVA
 

// |reftest| skip-if(!xulRuntime.shell)
function test() {

// Source location information
var withoutFileOrLine = Reflect.parse("42");
var withFile = Reflect.parse("42", {source:"foo.js"});
var withFileAndLine = Reflect.parse("42", {source:"foo.js", line:111});

Pattern({ source: null, start: { line: 1, column: 1 }, end: { line: 1, column: 3 } }).match(withoutFileOrLine.loc);
Pattern({ source: "foo.js", start: { line: 1, column: 1 }, end: { line: 1, column: 3 } }).match(withFile.loc);
Pattern({ source: "foo.js", start: { line: 111, column: 1 }, end: { line: 111, column: 3 } }).match(withFileAndLine.loc);

var withoutFileOrLine2 = Reflect.parse("foo +\nbar");
var withFile2 = Reflect.parse("foo +\nbar", {source:"foo.js"});
var withFileAndLine2 = Reflect.parse("foo +\nbar", {source:"foo.js", line:111});

Pattern({ source: null, start: { line: 1, column: 1 }, end: { line: 2, column: 4 } }).match(withoutFileOrLine2.loc);
Pattern({ source: "foo.js", start: { line: 1, column: 1 }, end: { line: 2, column: 4 } }).match(withFile2.loc);
Pattern({ source: "foo.js", start: { line: 111, column: 1 }, end: { line: 112, column: 4 } }).match(withFileAndLine2.loc);

var nested = Reflect.parse("(-b + sqrt(sqr(b) - 4 * a * c)) / (2 * a)", {source:"quad.js"});
var fourAC = nested.body[0].expression.left.right.arguments[0].right;

Pattern({ source: "quad.js", start: { line: 1, column: 21 }, end: { line: 1, column: 30 } }).match(fourAC.loc);

// No source location

assertEq("loc" in Reflect.parse("42", {loc:false}), false);
program([exprStmt(lit(42))]).assert(Reflect.parse("42", {loc:false}));

}

runtest(test);

Messung V0.5 in Prozent
C=95 H=81 G=88

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

*© 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.