mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: generate interfaces after all other typedefs (#9680)
This commit is contained in:
@@ -791,9 +791,6 @@ pub fn (mut g Gen) write_typedef_types() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.interface_ {
|
|
||||||
g.write_interface_typesymbol_declaration(typ)
|
|
||||||
}
|
|
||||||
.chan {
|
.chan {
|
||||||
if typ.name != 'chan' {
|
if typ.name != 'chan' {
|
||||||
g.type_definitions.writeln('typedef chan $typ.cname;')
|
g.type_definitions.writeln('typedef chan $typ.cname;')
|
||||||
@@ -825,6 +822,14 @@ static inline void __${typ.cname}_pushval($typ.cname ch, $el_stype val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generating interfaces after all the common types have been defined
|
||||||
|
// to prevent generating interface struct before definition of field types
|
||||||
|
for typ in g.table.type_symbols {
|
||||||
|
if typ.kind == .interface_ && typ.name !in c.builtins {
|
||||||
|
g.write_interface_typesymbol_declaration(typ)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut g Gen) write_interface_typesymbol_declaration(sym ast.TypeSymbol) {
|
pub fn (mut g Gen) write_interface_typesymbol_declaration(sym ast.TypeSymbol) {
|
||||||
|
|||||||
7
vlib/v/tests/interface_fields_typearray_test.v
Normal file
7
vlib/v/tests/interface_fields_typearray_test.v
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
struct Test {}
|
||||||
|
|
||||||
|
interface Testing {
|
||||||
|
tests []Test
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_field_typearray() {}
|
||||||
Reference in New Issue
Block a user