1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: cleanup spurious printlns, remove obsolete code

This commit is contained in:
Delyan Angelov 2021-02-17 14:59:42 +02:00
parent 217e8c9146
commit aa3d0ea345
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -259,12 +259,6 @@ pub fn (mut f Fmt) imports(imports []ast.Import) {
}
f.did_imports = true
mut num_imports := 0
/*
if imports.len == 1 {
imp_stmt_str := f.imp_stmt_str(imports[0])
f.out_imports.writeln('import ${imp_stmt_str}\n')
} else if imports.len > 1 {
*/
mut already_imported := map[string]bool{}
for imp in imports {
if imp.mod !in f.used_imports {
@ -710,7 +704,6 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
if field.comments.len > 0 {
next_first_line = util.imin(next_first_line, field.comments[0].pos.line_nr)
}
println('$field.name $next_first_line $before_last_line')
if next_first_line - before_last_line > 1 {
f.writeln('')
}
@ -1772,24 +1765,6 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
f.comments(arg.comments, {})
}
if node.is_method {
/*
// x.foo!() experiment
mut is_mut := false
if node.left is ast.Ident {
scope := f.file.scope.innermost(node.pos.pos)
x := node.left as ast.Ident
var := scope.find_var(x.name) or {
panic(err)
}
println(var.typ)
if var.typ != 0 {
sym := f.table.get_type_symbol(var.typ)
if method := f.table.type_find_method(sym, node.name) {
is_mut = method.args[0].is_mut
}
}
}
*/
if node.name in ['map', 'filter'] {
f.inside_lambda = true
defer {