Skip to content

Commit 46b1a8c

Browse files
committed
Re-parse modifiers and decorators so as not to skip errors
1 parent 5e6dfa7 commit 46b1a8c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/compiler/parser.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5484,11 +5484,7 @@ namespace ts {
54845484
}
54855485

54865486
function parseDeclaration(): Statement {
5487-
const [decorators, modifiers] = lookAhead(() => [
5488-
parseDecorators(),
5489-
parseModifiers(),
5490-
]);
5491-
5487+
const modifiers = lookAhead(() => (parseDecorators(), parseModifiers()));
54925488
// `parseListElement` attempted to get the reused node at this position,
54935489
// but the ambient context flag was not yet set, so the node appeared
54945490
// not reusable in that context.
@@ -5501,8 +5497,8 @@ namespace ts {
55015497
}
55025498

55035499
const node = <Statement>createNodeWithJSDoc(SyntaxKind.Unknown);
5504-
node.decorators = consumeNode(decorators);
5505-
node.modifiers = consumeNode(modifiers);
5500+
node.decorators = parseDecorators();
5501+
node.modifiers = parseModifiers();
55065502
if (isAmbient) {
55075503
for (const m of node.modifiers!) {
55085504
m.flags |= NodeFlags.Ambient;

0 commit comments

Comments
 (0)