mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler/cgen: fix github username in error message
This commit is contained in:
parent
a0b3d0809d
commit
d1210b9e9f
@ -296,24 +296,26 @@ fn platform_postfix_to_ifdefguard(name string) string {
|
|||||||
// Sort the types, make sure types that are referenced by other types
|
// Sort the types, make sure types that are referenced by other types
|
||||||
// are added before them.
|
// are added before them.
|
||||||
fn (v mut V) c_type_definitions() string {
|
fn (v mut V) c_type_definitions() string {
|
||||||
mut builtin_types := []Type
|
mut types := []Type // structs that need to be sorted
|
||||||
|
mut builtin_types := []Type // builtin types
|
||||||
// builtin types need to be on top
|
// builtin types need to be on top
|
||||||
builtins := ['string', 'array', 'map', 'Option']
|
builtins := ['string', 'array', 'map', 'Option']
|
||||||
for builtin in builtins {
|
for builtin in builtins {
|
||||||
typ := v.table.typesmap[builtin]
|
typ := v.table.typesmap[builtin]
|
||||||
builtin_types << typ
|
builtin_types << typ
|
||||||
}
|
}
|
||||||
// structs that need to be sorted
|
// everything except builtin will get sorted
|
||||||
mut types := []Type
|
for t_name, t in v.table.typesmap {
|
||||||
for _, t in v.table.typesmap {
|
if t_name in builtins {
|
||||||
if t.name in builtins {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
types << t
|
types << t
|
||||||
}
|
}
|
||||||
|
// sort structs
|
||||||
|
types_sorted := sort_structs(types)
|
||||||
// Generate C code
|
// Generate C code
|
||||||
return types_to_c(builtin_types,v.table) + '\n//----\n' +
|
return types_to_c(builtin_types,v.table) + '\n//----\n' +
|
||||||
types_to_c(sort_structs(types), v.table)
|
types_to_c(types_sorted, v.table)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn types_to_c(types []Type, table &Table) string {
|
fn types_to_c(types []Type, table &Table) string {
|
||||||
@ -367,7 +369,7 @@ fn sort_structs(types []Type) []Type {
|
|||||||
// sort graph
|
// sort graph
|
||||||
dep_graph_sorted := dep_graph.resolve()
|
dep_graph_sorted := dep_graph.resolve()
|
||||||
if !dep_graph_sorted.acyclic {
|
if !dep_graph_sorted.acyclic {
|
||||||
cerror('error: cgen.sort_structs() DGNAC.\nplease create a new issue here: https://github.com/vlang/v/issues and tag @joe.conigliaro')
|
cerror('error: cgen.sort_structs() DGNAC.\nplease create a new issue here: https://github.com/vlang/v/issues and tag @joe-conigliaro')
|
||||||
}
|
}
|
||||||
// sort types
|
// sort types
|
||||||
mut types_sorted := []Type
|
mut types_sorted := []Type
|
||||||
|
Loading…
Reference in New Issue
Block a user