vfmt: fix `$for method in App.methods {}` turning to App(methods)
parent
d6d202341a
commit
ba8cdb2977
|
@ -310,7 +310,7 @@ pub fn (mut f Fmt) stmt(node ast.Stmt) {
|
||||||
}
|
}
|
||||||
ast.CompFor {
|
ast.CompFor {
|
||||||
typ := f.no_cur_mod(f.table.type_to_str(it.typ))
|
typ := f.no_cur_mod(f.table.type_to_str(it.typ))
|
||||||
f.writeln('\$for $it.val_var in ${typ}($it.kind.str()) {')
|
f.writeln('\$for $it.val_var in ${typ}.$it.kind.str() {')
|
||||||
f.stmts(it.stmts)
|
f.stmts(it.stmts)
|
||||||
f.writeln('}')
|
f.writeln('}')
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,9 @@ fn (mut app App) int_method2() int {
|
||||||
fn (mut app App) string_arg(x string) {
|
fn (mut app App) string_arg(x string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn no_lines(s string) string { return s.replace('\n', ' ') }
|
fn no_lines(s string) string {
|
||||||
|
return s.replace('\n', ' ')
|
||||||
|
}
|
||||||
|
|
||||||
fn test_comptime_for() {
|
fn test_comptime_for() {
|
||||||
println(@FN)
|
println(@FN)
|
||||||
|
@ -46,7 +48,7 @@ fn test_comptime_for_with_if() {
|
||||||
println(@FN)
|
println(@FN)
|
||||||
$for method in App.methods {
|
$for method in App.methods {
|
||||||
println(' method: ' + no_lines('$method'))
|
println(' method: ' + no_lines('$method'))
|
||||||
$if method.typ is fn() {
|
$if method.typ is fn () {
|
||||||
assert method.name in ['run', 'method2']
|
assert method.name in ['run', 'method2']
|
||||||
}
|
}
|
||||||
$if method.return_type is int {
|
$if method.return_type is int {
|
||||||
|
|
Loading…
Reference in New Issue