Fix completion record for labeled statement (#13084)
`{labelAlthoughIMeantItToBeAKey: value}` strikes again :)
This commit is contained in:
parent
691c46846f
commit
b971e00eb0
@ -21,6 +21,9 @@ const x = (n) => do {
|
||||
}
|
||||
{ break; "l" }
|
||||
case 7:
|
||||
{ a: "m" }
|
||||
break;
|
||||
case 8:
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,4 +34,5 @@ expect(x(3)).toBeUndefined()
|
||||
expect(x(4)).toBe("g")
|
||||
expect(x(5)).toBe("j")
|
||||
expect(x(6)).toBe("k")
|
||||
expect(x(7)).toBeUndefined()
|
||||
expect(x(7)).toBe("m")
|
||||
expect(x(8)).toBeUndefined()
|
||||
|
||||
@ -21,5 +21,8 @@ const x = (n) => do {
|
||||
}
|
||||
{ break; "l" }
|
||||
case 7:
|
||||
{ a: "m" }
|
||||
break;
|
||||
case 8:
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,5 +62,10 @@ const x = n => function () {
|
||||
}
|
||||
|
||||
case 7:
|
||||
{
|
||||
a: return "m";
|
||||
}
|
||||
|
||||
case 8:
|
||||
}
|
||||
}();
|
||||
|
||||
@ -210,7 +210,12 @@ function _getCompletionRecords(
|
||||
if (path.isIfStatement()) {
|
||||
records = addCompletionRecords(path.get("consequent"), records, context);
|
||||
records = addCompletionRecords(path.get("alternate"), records, context);
|
||||
} else if (path.isDoExpression() || path.isFor() || path.isWhile()) {
|
||||
} else if (
|
||||
path.isDoExpression() ||
|
||||
path.isFor() ||
|
||||
path.isWhile() ||
|
||||
path.isLabeledStatement()
|
||||
) {
|
||||
// @ts-expect-error(flow->ts): todo
|
||||
records = addCompletionRecords(path.get("body"), records, context);
|
||||
} else if (path.isProgram() || path.isBlockStatement()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user