parser, vfmt: multi line comments are not treated as follow-up comments anymore (#9892)
parent
5152cd4a62
commit
b406de20df
|
@ -1,3 +1,10 @@
|
||||||
|
import time // foo
|
||||||
|
|
||||||
|
/*
|
||||||
|
block
|
||||||
|
comment
|
||||||
|
*/
|
||||||
|
|
||||||
fn fun() int {
|
fn fun() int {
|
||||||
// comment zero
|
// comment zero
|
||||||
return 0 // another comment
|
return 0 // another comment
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import time // foo
|
||||||
|
/*
|
||||||
|
block
|
||||||
|
comment
|
||||||
|
*/
|
||||||
|
|
||||||
fn fun() int {
|
fn fun() int {
|
||||||
return /* comment zero */ 0 // another comment
|
return /* comment zero */ 0 // another comment
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,7 +642,7 @@ pub fn (mut p Parser) eat_comments(cfg EatCommentsConfig) []ast.Comment {
|
||||||
mut comments := []ast.Comment{}
|
mut comments := []ast.Comment{}
|
||||||
for {
|
for {
|
||||||
if p.tok.kind != .comment || (cfg.same_line && p.tok.line_nr > line)
|
if p.tok.kind != .comment || (cfg.same_line && p.tok.line_nr > line)
|
||||||
|| (cfg.follow_up && p.tok.line_nr > line + 1) {
|
|| (cfg.follow_up && (p.tok.line_nr > line + 1 || p.tok.lit.contains('\n'))) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
comments << p.comment()
|
comments << p.comment()
|
||||||
|
|
Loading…
Reference in New Issue