зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1034585 - Sources with BreakStatements can't be parsed correctly, r=past
This commit is contained in:
Родитель
5ff125e46c
Коммит
715ecc2059
|
@ -60,7 +60,13 @@ function test() {
|
|||
verify("foo = bar", e => e.name == "bar", [1, 6], [1, 9]);
|
||||
verify("\nfoo\n=\nbar\n", e => e.name == "bar", [4, 0], [4, 3]);
|
||||
|
||||
// LabeledStatement and ContinueStatement, because it's 1968 again
|
||||
// LabeledStatement, BreakStatement and ContinueStatement, because it's 1968 again
|
||||
|
||||
verify("foo: bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n:\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
|
||||
verify("foo: for(;;) break foo", e => e.name == "foo", [1, 19], [1, 22]);
|
||||
verify("\nfoo\n:\nfor(\n;\n;\n)\nbreak\nfoo\n", e => e.name == "foo", [9, 0], [9, 3]);
|
||||
|
||||
verify("foo: bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n:\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
|
|
|
@ -450,8 +450,8 @@ let ParserHelpers = {
|
|||
loc.end.column = loc.start.column + aNode.name.length;
|
||||
return loc;
|
||||
}
|
||||
if (parentType == "ContinueStatement") {
|
||||
// e.g. continue label
|
||||
if (parentType == "ContinueStatement" || parentType == "BreakStatement") {
|
||||
// e.g. continue label; or break label;
|
||||
// The location is unavailable for the identifier node "label".
|
||||
let loc = Cu.cloneInto(parentLocation, {});
|
||||
loc.start.line = loc.end.line;
|
||||
|
|
Загрузка…
Ссылка в новой задаче