parent
45796601c4
commit
da7c97e0bb
|
@ -196,6 +196,7 @@ function attach(comments, ast, text, options) {
|
|||
handleTemplateLiteralComments(enclosingNode, comment) ||
|
||||
handleIfStatementComments(enclosingNode, followingNode, comment) ||
|
||||
handleClassComments(enclosingNode, comment) ||
|
||||
handleLabeledStatementComments(enclosingNode, comment) ||
|
||||
handleCallExpressionComments(precedingNode, enclosingNode, comment) ||
|
||||
handlePropertyComments(enclosingNode, comment) ||
|
||||
handleExportNamedDeclarationComments(enclosingNode, comment) ||
|
||||
|
@ -578,6 +579,14 @@ function handleObjectPropertyComments(enclosingNode, comment) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function handleLabeledStatementComments(enclosingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "LabeledStatement") {
|
||||
addLeadingComment(enclosingNode, comment);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleCallExpressionComments(precedingNode, enclosingNode, comment) {
|
||||
if (
|
||||
enclosingNode &&
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`comment.js 1`] = `
|
||||
"{
|
||||
inf_leave: // goto emulation
|
||||
for (;;) {}
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{
|
||||
// goto emulation
|
||||
inf_leave: for (;;) {
|
||||
}
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`empty_label.js 1`] = `
|
||||
"a:;
|
||||
b
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
inf_leave: // goto emulation
|
||||
for (;;) {}
|
||||
}
|
Loading…
Reference in New Issue