Skip to content

Commit

Permalink
Fix trailing doc comment conversion, update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
milesziemer committed May 8, 2024
1 parent 24c1ddd commit c039f6f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public TokenTree apply(TokenTree tree) {
updateNestedChildren(br);
}
}
// Fix any trailing doc comments in shape bodies
for (TreeCursor members : shapeStatements.findChildrenByType(TreeType.SHAPE_MEMBERS)) {
TreeCursor closeBrace = members.getLastChild();
if (closeBrace != null) {
TreeCursor possibleTrailingWs = closeBrace.getPreviousSibling();
if (possibleTrailingWs != null && possibleTrailingWs.getTree().getType() == TreeType.WS) {
updateDirectChildren(possibleTrailingWs);
}
}
}
}

return tree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ structure Foo {
// 17 (change)
bar: String

/// 18 (TODO: handle this case somehow)
/// 17a (keep)
@length(min: 1)
baz: String = ""

/// 18 (TODO: Fix trailing comment after VALUE_ASSIGNMENT)

}

// 19 (change)
Expand All @@ -45,4 +50,10 @@ apply Foo @tags(["a"])
list Baz {
member: Integer
}
// 21 (change)

structure Foo2 {
foo2: String

// 21 (change)
}
// 22 (change)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ structure Foo {
/// 17 (change)
bar: String

/// 18 (TODO: handle this case somehow)
/// 17a (keep)
@length(min: 1)
baz: String = ""

/// 18 (TODO: Fix trailing comment after VALUE_ASSIGNMENT)
}

/// 19 (change)
Expand All @@ -46,4 +50,10 @@ list Baz {
member: Integer
}

/// 21 (change)
structure Foo2 {
foo2: String

/// 21 (change)
}

/// 22 (change)

0 comments on commit c039f6f

Please sign in to comment.