1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/examples/compiletime/compile-time-for.v
2020-07-25 00:02:44 +02:00

46 lines
759 B
V

module main
struct App {
test string [test]
mut:
a string
}
fn main() {
println('All functions')
$for method in App.methods {
$if method.@type is int {
println('hi')
}
println('$method.name.len')
println('$method.name.str')
println('Method: $method.name')
println('Attributes: $method.attrs')
println('Return type: $method.ret_type')
}
println('All integer functions')
$for method in App.methods {
println('Method: $method.name')
println('Attributes: $method.attrs')
}
$for field in App.fields {
$if field.@type is string {
println(field)
}
}
}
fn (mut app App) method_one() {
}
fn (mut app App) method_two() {
}
fn (mut app App) method_three() int {
return 0
}
fn (mut app App) method_four() int {
return 1
}