mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-11-02 20:47:33 +09:00
420857 - Part 1: Report the position of opening brace for missing brace error in function body.
This commit is contained in:
parent
379a4231fe
commit
e5f1edc00c
4 changed files with 71 additions and 6 deletions
30
js/src/jit-test/tests/parser/missing-closing-brace.js
Normal file
30
js/src/jit-test/tests/parser/missing-closing-brace.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
function test(source, [lineNumber, columnNumber]) {
|
||||
let caught = false;
|
||||
try {
|
||||
Reflect.parse(source, { source: "foo.js" });
|
||||
} catch (e) {
|
||||
assertEq(e.message.includes("missing } "), true);
|
||||
let notes = getErrorNotes(e);
|
||||
assertEq(notes.length, 1);
|
||||
let note = notes[0];
|
||||
assertEq(note.message, "{ opened at line " + lineNumber + ", column " + columnNumber);
|
||||
assertEq(note.fileName, "foo.js");
|
||||
assertEq(note.lineNumber, lineNumber);
|
||||
assertEq(note.columnNumber, columnNumber);
|
||||
caught = true;
|
||||
}
|
||||
assertEq(caught, true);
|
||||
}
|
||||
|
||||
// Function
|
||||
|
||||
test(`
|
||||
function test1() {
|
||||
}
|
||||
function test2() {
|
||||
if (true) {
|
||||
//}
|
||||
}
|
||||
function test3() {
|
||||
}
|
||||
`, [4, 17]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue