Skip to content

Commit 8ff0115

Browse files
authored
_ no longer forced for keywords as var/struct fields (#139)
1 parent 74d11ad commit 8ff0115

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

tests/module/module.vv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module fn_
1+
module fn
File renamed without changes.
File renamed without changes.

util.v

+3-8
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ fn go2v_type(typ string) string {
5151
}
5252

5353
fn (mut app App) go2v_ident(ident string) string {
54+
if ident == 'nil' {
55+
return 'unsafe { nil }'
56+
}
5457
if app.force_upper || ident in app.struct_or_alias {
5558
app.force_upper = false
56-
if ident in v_keywords_which_are_not_go_keywords {
57-
return ident + '_'
58-
}
5959
if ident in ['string', 'int', 'float64'] {
6060
return ident
6161
}
@@ -64,12 +64,7 @@ fn (mut app App) go2v_ident(ident string) string {
6464
return go2v_ident2(ident)
6565
}
6666

67-
const v_keywords_which_are_not_go_keywords = ['match', 'lock', 'fn', 'enum', 'in', 'as']
68-
6967
fn go2v_ident2(ident string) string {
7068
x := ident.camel_to_snake() // to_lower()) // TODO ?
71-
if x in v_keywords_which_are_not_go_keywords {
72-
return x + '_'
73-
}
7469
return x
7570
}

0 commit comments

Comments
 (0)