Fix comment issue with try finally (#5252)

master
Aquib Master 2018-10-13 05:48:49 +13:00 committed by Jed Fox
parent 65b2454dd8
commit 3369be0ca2
3 changed files with 37 additions and 27 deletions

View File

@ -93,6 +93,12 @@ function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
comment,
options
) ||
handleTryStatementComments(
enclosingNode,
precedingNode,
followingNode,
comment
) ||
handleClassComments(enclosingNode, precedingNode, followingNode, comment) ||
handleLabeledStatementComments(enclosingNode, comment) ||
handleCallExpressionComments(precedingNode, enclosingNode, comment) ||

View File

@ -1851,30 +1851,34 @@ const CONNECTION_STATUS = (exports.CONNECTION_STATUS = {
`;
exports[`try.js - flow-verify 1`] = `
// comment 1
try {
// comment 2
// Comment 1
try { // Comment 2
// Comment 3
}
// comment 3
catch(e) {
// comment 4
// Comment 4
catch(e) { // Comment 5
// Comment 6
}
// comment 5
finally // comment 6
{
// comment 7
// Comment 7
finally { // Comment 8
// Comment 9
}
// Comment 10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// comment 1
// Comment 1
try {
// comment 2
// Comment 2
// Comment 3
} catch (e) {
// comment 3
// comment 4
} finally { // comment 6
// comment 5
// comment 7
// Comment 4
// Comment 5
// Comment 6
} finally {
// Comment 7
// Comment 8
// Comment 9
}
// Comment 10
`;

View File

@ -1,13 +1,13 @@
// comment 1
try {
// comment 2
// Comment 1
try { // Comment 2
// Comment 3
}
// comment 3
catch(e) {
// comment 4
// Comment 4
catch(e) { // Comment 5
// Comment 6
}
// comment 5
finally // comment 6
{
// comment 7
// Comment 7
finally { // Comment 8
// Comment 9
}
// Comment 10