This commit is contained in:
2025-03-24 06:44:39 +01:00
parent 0df10f5cb3
commit 598b312140
371 changed files with 8238 additions and 9082 deletions

View File

@@ -33,7 +33,9 @@ pub fn (struct_ Struct) vgen() string {
comments := if struct_.description.trim_space() != '' {
'// ${struct_.description.trim_space()}'
} else {''}
} else {
''
}
priv_fields := struct_.fields.filter(!it.is_mut && !it.is_pub).map(it.vgen())
pub_fields := struct_.fields.filter(!it.is_mut && it.is_pub).map(it.vgen())
@@ -51,16 +53,15 @@ pub fn (struct_ Struct) vgen() string {
return struct_str
}
pub struct Interface {
pub mut:
name string
description string
is_pub bool
embeds []Interface @[str: skip]
embeds []Interface @[str: skip]
attrs []Attribute
fields []StructField
methods []Function
methods []Function
}
pub fn (iface Interface) vgen() string {
@@ -104,8 +105,8 @@ pub mut:
is_pub bool
is_mut bool
is_ref bool
anon_struct Struct @[str: skip] // sometimes fields may hold anonymous structs
structure Struct @[str: skip]
anon_struct Struct @[str: skip] // sometimes fields may hold anonymous structs
structure Struct @[str: skip]
}
pub fn (field StructField) vgen() string {
@@ -133,4 +134,4 @@ pub fn (s Struct) typescript() string {
name := texttools.pascal_case(s.name)
fields := s.fields.map(it.typescript()).join_lines()
return 'export interface ${name} {\n${fields}\n}'
}
}