mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: remove c.pref.is_test
exception for calling private methods in _other_ modules (#16872)
This commit is contained in:
parent
3598e7d08e
commit
da68b2d369
@ -211,7 +211,7 @@ pub fn (flags []Flag) get_strings(name string) ![]string {
|
||||
|
||||
// parse parses flag values from arguments and return
|
||||
// an array of arguments with all consumed elements removed.
|
||||
fn (mut flag Flag) parse(args []string, posix_mode bool) ![]string {
|
||||
pub fn (mut flag Flag) parse(args []string, posix_mode bool) ![]string {
|
||||
if flag.matches(args, posix_mode) {
|
||||
if flag.flag == .bool {
|
||||
new_args := flag.parse_bool(args)!
|
||||
|
@ -321,7 +321,7 @@ pub mut:
|
||||
|
||||
// Reset RE object
|
||||
[direct_array_access; inline]
|
||||
fn (mut re RE) reset() {
|
||||
pub fn (mut re RE) reset() {
|
||||
re.cc_index = 0
|
||||
|
||||
mut i := 0
|
||||
|
@ -15,7 +15,7 @@ pub mut:
|
||||
title JobTitle
|
||||
}
|
||||
|
||||
fn (e Employee) to_toml() string {
|
||||
pub fn (e Employee) to_toml() string {
|
||||
mut mp := map[string]toml.Any{}
|
||||
mp['name'] = toml.Any(e.name)
|
||||
mp['age'] = toml.Any(e.age)
|
||||
@ -25,7 +25,7 @@ fn (e Employee) to_toml() string {
|
||||
return mp.to_toml()
|
||||
}
|
||||
|
||||
fn (mut e Employee) from_toml(any toml.Any) {
|
||||
pub fn (mut e Employee) from_toml(any toml.Any) {
|
||||
mp := any.as_map()
|
||||
e.name = mp['name'] or { toml.Any('') }.string()
|
||||
e.age = mp['age'] or { toml.Any(0) }.int()
|
||||
|
@ -6,7 +6,7 @@ module ast
|
||||
import v.cflag
|
||||
|
||||
// check if cflag is in table
|
||||
fn (t &Table) has_cflag(flag cflag.CFlag) bool {
|
||||
pub fn (t &Table) has_cflag(flag cflag.CFlag) bool {
|
||||
for cf in t.cflags {
|
||||
if cf.os == flag.os && cf.name == flag.name && cf.value == flag.value {
|
||||
return true
|
||||
|
@ -1502,7 +1502,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
|
||||
node.is_noreturn = method.is_noreturn
|
||||
node.is_ctor_new = method.is_ctor_new
|
||||
node.return_type = method.return_type
|
||||
if !method.is_pub && !c.pref.is_test && method.mod != c.mod {
|
||||
if !method.is_pub && method.mod != c.mod {
|
||||
// If a private method is called outside of the module
|
||||
// its receiver type is defined in, show an error.
|
||||
// println('warn $method_name lef.mod=$left_type_sym.mod c.mod=$c.mod')
|
||||
|
@ -143,7 +143,7 @@ fn (am AssetManager) include(asset_type string, combine bool) string {
|
||||
|
||||
// dont return option until size limit is removed
|
||||
// fn (mut am AssetManager) add(asset_type, file string) ?bool {
|
||||
fn (mut am AssetManager) add(asset_type string, file string) bool {
|
||||
pub fn (mut am AssetManager) add(asset_type string, file string) bool {
|
||||
if !os.exists(file) {
|
||||
// return error('vweb.assets: cannot add asset $file, it does not exist')
|
||||
return false
|
||||
|
@ -113,7 +113,8 @@ fn new_parser(srce string, convert_type bool) Parser {
|
||||
}
|
||||
}
|
||||
|
||||
fn (mut p Parser) decode() !Any {
|
||||
// decode decodes provided JSON
|
||||
pub fn (mut p Parser) decode() !Any {
|
||||
p.next()
|
||||
p.next_with_err()!
|
||||
fi := p.decode_value()!
|
||||
|
Loading…
Reference in New Issue
Block a user