mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Keep trailing comments at the end of a file
This commit is contained in:
parent
bd5b9700ca
commit
f3dd9e411f
2 changed files with 34 additions and 13 deletions
|
@ -363,6 +363,16 @@ fn eat_line_comment<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
// We made it to the end of the bytes. This means there's a comment without a trailing newline.
|
||||
let delta = (col - initial_col) as usize;
|
||||
let comment = unsafe { std::str::from_utf8_unchecked(&initial[..delta]) };
|
||||
|
||||
if is_doc_comment {
|
||||
comments_and_newlines.push(CommentOrNewline::DocComment(comment));
|
||||
} else {
|
||||
comments_and_newlines.push(CommentOrNewline::LineComment(comment));
|
||||
}
|
||||
|
||||
Good {
|
||||
row,
|
||||
col,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue