Skip to content

Commit c109014

Browse files
committed
Restore earlier behaviour when parsing non-simple arrow function bodies
1 parent 27f32eb commit c109014

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/parser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,8 +3038,9 @@ module ts {
30383038

30393039
// If we have an arrow, then try to parse the body. Even if not, try to parse if we
30403040
// have an opening brace, just in case we're in an error state.
3041-
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>");
3042-
if (arrowFunction.equalsGreaterThanToken.kind === SyntaxKind.EqualsGreaterThanToken || token === SyntaxKind.OpenBraceToken) {
3041+
var lastToken = token;
3042+
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition:*/false, Diagnostics._0_expected, "=>");
3043+
if (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken) {
30433044
arrowFunction.body = parseArrowFunctionExpressionBody();
30443045
}
30453046
else {

0 commit comments

Comments
 (0)