Skip to content

Commit

Permalink
fix fn_pub
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Aug 6, 2024
1 parent 9356a73 commit 5a5e4b3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions fn_decl.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
// Use of this source code is governed by a GPL license that can be found in the LICENSE file.
fn (mut app App) func_decl(decl Decl) {
method_name := decl.name.name.to_lower()
// Capital? Then it's public in Go
is_pub := decl.name.name[0].is_capital()
if is_pub {
app.gen('pub ')
}
// println('FUNC DECL ${method_name}')

// mut recv := ''
// if decl.recv.list.len > 0 {
// recv_type := type_or_ident(decl.recv.list[0].typ)
Expand Down
2 changes: 1 addition & 1 deletion tests/fn_call/fn_call.vv
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pub mut:
struct Test2 {
}

fn (t Test2) test() {
pub fn (t Test2) test() {
println('Test')
}
2 changes: 1 addition & 1 deletion tests/fn_case/fn_case.vv
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() {
func()
}

fn func() {
pub fn func() {
}
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/fn_pub/fn_pub.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module main

pub fn abc(a int, b []string, c rune) string {
}
3 changes: 0 additions & 3 deletions untested/fn_pub/fn_pub.vv

This file was deleted.

0 comments on commit 5a5e4b3

Please sign in to comment.