mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
parent
da0485f1d1
commit
e1147c73d8
@ -634,9 +634,6 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) GenO
|
||||
b.write_string2('\n// V result_xxx definitions:\n', g.out_results.str())
|
||||
}
|
||||
b.write_string2('\n// V definitions:\n', g.definitions.str())
|
||||
if g.sort_fn_definitions.len > 0 {
|
||||
b.write_string2('\n// V sort fn definitions:\n', g.sort_fn_definitions.str())
|
||||
}
|
||||
if !pref_.parallel_cc {
|
||||
b.writeln('\n// V global/const non-precomputed definitions:')
|
||||
for var_name in g.sorted_global_const_names {
|
||||
@ -651,6 +648,9 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) GenO
|
||||
if interface_table.len > 0 {
|
||||
b.write_string2('\n// V interface table:\n', interface_table)
|
||||
}
|
||||
if g.sort_fn_definitions.len > 0 {
|
||||
b.write_string2('\n// V sort fn definitions:\n', g.sort_fn_definitions.str())
|
||||
}
|
||||
if g.hotcode_definitions.len > 0 {
|
||||
b.write_string2('\n// V hotcode definitions:\n', g.hotcode_definitions.str())
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
interface Person {
|
||||
identify() int
|
||||
}
|
||||
|
||||
struct Boy {}
|
||||
|
||||
fn (self Boy) identify() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
struct Girl {}
|
||||
|
||||
fn (self Girl) identify() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
mut ppl := []Person{}
|
||||
ppl << &Girl{}
|
||||
ppl << Boy{}
|
||||
ppl[0].identify()
|
||||
ppl.sort(a.identify() < b.identify())
|
||||
assert ppl == [Person(Boy{}), Girl{}]
|
||||
println(ppl)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user