Skip to content

Commit

Permalink
add pub to consts if original name started with capital (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
JalonSolov authored Aug 10, 2024
1 parent f2206eb commit 8ec2890
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 1,053 deletions.
3 changes: 3 additions & 0 deletions struct.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ fn (mut app App) gen_decl(decl Decl) {
fn (mut app App) const_decl(spec Spec) {
// app.genln('// const')
for i, name in spec.names {
if name.name.starts_with_capital() {
app.gen('pub ')
}
n := app.go2v_ident(name.name)
app.gen('const ${n} = ')
app.expr(spec.values[i])
Expand Down
4 changes: 2 additions & 2 deletions tests/case/case.vv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module main

const uppercase_with_underscores = 0
pub const uppercase_with_underscores = 0
const lowercase_with_underscores = 0
const camel_case = 0
const upper_camel_case = 0
pub const upper_camel_case = 0
const uppercase = 0
const lowercase = 0

Expand Down
292 changes: 0 additions & 292 deletions tests/fn_call/11.fn_call.go.json

This file was deleted.

Loading

0 comments on commit 8ec2890

Please sign in to comment.