Fix babylon misplacing comments (#3441)
* Fix comments in class method args * Fix comments in obj property
This commit is contained in:
1 parent
4f24892e53
commit
934e4d3027
4 files changed
+24
-19
No files matched your search
@@ -207,7 +207,6 @@ function attach(comments, ast, text, options) {
|
||||
comment
|
||||
) ||
|
||||
handleImportSpecifierComments(enclosingNode, comment) ||
|
||||
handleObjectPropertyComments(enclosingNode, comment) ||
|
||||
handleForComments(enclosingNode, precedingNode, comment) ||
|
||||
handleUnionTypeComments(
|
||||
precedingNode,
|
||||
@@ -273,7 +272,6 @@ function attach(comments, ast, text, options) {
|
||||
handlePropertyComments(enclosingNode, comment) ||
|
||||
handleExportNamedDeclarationComments(enclosingNode, comment) ||
|
||||
handleOnlyComments(enclosingNode, ast, comment, isLastComment) ||
|
||||
handleClassMethodComments(enclosingNode, comment) ||
|
||||
handleTypeAliasComments(enclosingNode, followingNode, comment) ||
|
||||
handleVariableDeclaratorComments(enclosingNode, followingNode, comment)
|
||||
) {
|
||||
@@ -756,14 +754,6 @@ function handleImportSpecifierComments(enclosingNode, comment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleObjectPropertyComments(enclosingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "ObjectProperty") {
|
||||
addLeadingComment(enclosingNode, comment);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleLabeledStatementComments(enclosingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "LabeledStatement") {
|
||||
addLeadingComment(enclosingNode, comment);
|
||||
@@ -887,14 +877,6 @@ function handleAssignmentPatternComments(enclosingNode, comment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleClassMethodComments(enclosingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "ClassMethod") {
|
||||
addTrailingComment(enclosingNode, comment);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleTypeAliasComments(enclosingNode, followingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "TypeAlias") {
|
||||
addLeadingComment(enclosingNode, comment);
|
||||
|
||||
@@ -41,6 +41,14 @@ class X {
|
||||
'<div class="ag-large-textarea"></div>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
export class SnapshotLogger {
|
||||
constructor(
|
||||
retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
|
||||
snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
|
||||
) {
|
||||
}
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class A // comment 1
|
||||
// comment 2
|
||||
@@ -87,4 +95,11 @@ class X {
|
||||
"</div>";
|
||||
}
|
||||
|
||||
export class SnapshotLogger {
|
||||
constructor(
|
||||
retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
|
||||
snapshotInterval: number = 30 * 1000 // snapshot no more than every 30s
|
||||
) {}
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -38,3 +38,11 @@ class X {
|
||||
'<div class="ag-large-textarea"></div>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
export class SnapshotLogger {
|
||||
constructor(
|
||||
retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
|
||||
snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["flow"]);
|
||||
run_spec(__dirname, ["flow", "babylon"]);
|
||||
Reference in new issue
Block a user