refactor and reorganize code modules
This commit is contained in:
6
lib/core/code/templates/function/function.v.template
Normal file
6
lib/core/code/templates/function/function.v.template
Normal file
@@ -0,0 +1,6 @@
|
||||
@if function.description != ''
|
||||
// @{function.description}
|
||||
@endif
|
||||
pub fn @receiver @{name}(@{params}) @{result} {
|
||||
@{function.body.trim_space().replace('\t', '')}
|
||||
}
|
||||
15
lib/core/code/templates/interface/interface.v.template
Normal file
15
lib/core/code/templates/interface/interface.v.template
Normal file
@@ -0,0 +1,15 @@
|
||||
// @{iface.description}
|
||||
@if iface.attrs.len > 0
|
||||
[
|
||||
@for attr in iface.attrs
|
||||
@{attr.name}
|
||||
@end
|
||||
]
|
||||
@end
|
||||
@{prefix} interface @{name} {
|
||||
@{fields.join_lines()}
|
||||
@if mut_fields.len > 0
|
||||
mut:
|
||||
@{mut_fields.join_lines()}
|
||||
@end
|
||||
}
|
||||
26
lib/core/code/templates/struct/struct.v.template
Normal file
26
lib/core/code/templates/struct/struct.v.template
Normal file
@@ -0,0 +1,26 @@
|
||||
@{comments}
|
||||
@if struct_.attrs.len > 0
|
||||
[
|
||||
@for attr in struct_.attrs
|
||||
@{attr.name}
|
||||
@end
|
||||
]
|
||||
@end
|
||||
@{prefix}struct @{name} {
|
||||
@for embed in struct_.embeds
|
||||
@{embed.get_type_symbol()}
|
||||
@end
|
||||
@{priv_fields.join_lines()}
|
||||
@if pub_fields.len > 0
|
||||
pub:
|
||||
@{pub_fields.join_lines()}
|
||||
@end
|
||||
@if mut_fields.len > 0
|
||||
mut:
|
||||
@{mut_fields.join_lines()}
|
||||
@end
|
||||
@if pub_mut_fields.len > 0
|
||||
pub mut:
|
||||
@{pub_mut_fields.join_lines()}
|
||||
@end
|
||||
}
|
||||
7
lib/core/code/templates/v.mod.template
Normal file
7
lib/core/code/templates/v.mod.template
Normal file
@@ -0,0 +1,7 @@
|
||||
Module {
|
||||
name: '@{mod.name}'
|
||||
description: '@{mod.description}'
|
||||
version: '@{mod.version}'
|
||||
vcs: '@{mod.vcs}'
|
||||
license: '@{mod.license}'
|
||||
}
|
||||
Reference in New Issue
Block a user