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

do not generate interface tables for unused interfaces

This commit is contained in:
Alexander Medvednikov 2019-11-09 18:13:51 +03:00
parent be4eaa680a
commit f33d8bd596
2 changed files with 6 additions and 3 deletions

View File

@ -397,6 +397,7 @@ fn (v &V) interface_table() string {
continue continue
} }
mut methods := '' mut methods := ''
sb.writeln('// NR methods = $t.gen_types.len')
for i, gen_type in t.gen_types { for i, gen_type in t.gen_types {
methods += '{' methods += '{'
for i, method in t.methods { for i, method in t.methods {
@ -410,11 +411,12 @@ fn (v &V) interface_table() string {
// Speaker_Cat_index = 0 // Speaker_Cat_index = 0
sb.writeln('int _${t.name}_${gen_type}_index = $i;') sb.writeln('int _${t.name}_${gen_type}_index = $i;')
} }
if t.methods.len == 0 { if t.gen_types.len > 0 {
methods = '{TCCSKIP(0)}' // methods = '{TCCSKIP(0)}'
} // }
sb.writeln('void* (* ${t.name}_name_table[][$t.methods.len]) = ' + sb.writeln('void* (* ${t.name}_name_table[][$t.methods.len]) = ' +
'{ $methods }; ') '{ $methods }; ')
}
continue continue
} }
return sb.str() return sb.str()

View File

@ -653,6 +653,7 @@ pub fn (v &V) get_user_files() []string {
mut user_files := []string mut user_files := []string
if v.pref.is_test { if v.pref.is_test {
// TODO this somtimes fails on CI
user_files << filepath.join(v.vroot,'vlib','compiler','preludes','tests_assertions.v') user_files << filepath.join(v.vroot,'vlib','compiler','preludes','tests_assertions.v')
} }