From e1132156f5dcdf6145d9064f1eafc203a3d0f9f7 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 16 Jan 2020 18:41:34 +0100 Subject: [PATCH] make sqlite.DB public; make string.left/right private --- vlib/builtin/string.v | 4 ++-- vlib/compiler/fn.v | 2 +- vlib/sqlite/sqlite.v | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 7512fe27a0..2ddc27e2ef 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -470,7 +470,7 @@ pub fn (s string) split_into_lines() []string { } // 'hello'.left(2) => 'he' -pub fn (s string) left(n int) string { +fn (s string) left(n int) string { if n >= s.len { return s } @@ -478,7 +478,7 @@ pub fn (s string) left(n int) string { } // 'hello'.right(2) => 'llo' -pub fn (s string) right(n int) string { +fn (s string) right(n int) string { if n >= s.len { return '' } diff --git a/vlib/compiler/fn.v b/vlib/compiler/fn.v index 7896f21d9b..aa2e893db1 100644 --- a/vlib/compiler/fn.v +++ b/vlib/compiler/fn.v @@ -669,7 +669,7 @@ fn (p mut Parser) check_unused_and_mut_vars() { p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx) } if !var.is_changed && var.is_mut && !p.pref.is_repl && !p.pref.translated && var.typ != 'T*' && p.mod != 'ui' && var.typ != 'App*' { - //p.warn_or_error('`$var.name` is declared as mutable, but it was never changed') + p.warn_or_error('`$var.name` is declared as mutable, but it was never changed') } } } diff --git a/vlib/sqlite/sqlite.v b/vlib/sqlite/sqlite.v index ada8aa5214..f01d5b5dcc 100644 --- a/vlib/sqlite/sqlite.v +++ b/vlib/sqlite/sqlite.v @@ -8,12 +8,12 @@ module sqlite struct C.sqlite3 struct C.sqlite3_stmt -struct DB { +pub struct DB { mut: conn &C.sqlite3 } -struct Row { +pub struct Row { pub mut: vals []string } @@ -39,6 +39,7 @@ fn C.sqlite3_open() fn C.sqlite3_step() int fn C.sqlite3_prepare_v2() fn C.sqlite3_finalize() +fn C.sqlite3_column_count(voidptr) int pub fn (db DB) q_string(query string) string { stmt := &C.sqlite3_stmt(0) @@ -49,7 +50,6 @@ pub fn (db DB) q_string(query string) string { return res } -fn C.sqlite3_column_count(voidptr) int pub fn (db DB) exec(query string) []Row { stmt := &C.sqlite3_stmt(0)