mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@@ -760,6 +760,7 @@ pub fn (mut f Fmt) branch_stmt(node ast.BranchStmt) {
|
||||
pub fn (mut f Fmt) comp_for(node ast.CompFor) {
|
||||
typ := f.no_cur_mod(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
|
||||
f.write('\$for $node.val_var in ${typ}.$node.kind.str() {')
|
||||
f.mark_types_import_as_used(node.typ)
|
||||
if node.stmts.len > 0 || node.pos.line_nr < node.pos.last_line {
|
||||
f.writeln('')
|
||||
f.stmts(node.stmts)
|
||||
|
||||
14
vlib/v/fmt/tests/import_with_symbols_keep.vv
Normal file
14
vlib/v/fmt/tests/import_with_symbols_keep.vv
Normal file
@@ -0,0 +1,14 @@
|
||||
import readline { Readline }
|
||||
|
||||
fn no_lines(s string) string {
|
||||
return s.replace('\n', ' ')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut methods := []string{}
|
||||
$for method in Readline.methods {
|
||||
methods << method.name
|
||||
}
|
||||
assert 'read_line_utf8' in methods
|
||||
assert 'read_line' in methods
|
||||
}
|
||||
Reference in New Issue
Block a user