diff --git a/.github/workflows/v_apps_and_modules_compile_ci.yml b/.github/workflows/v_apps_and_modules_compile_ci.yml index 77c861fe24c832..9e6c79bde3c0a7 100644 --- a/.github/workflows/v_apps_and_modules_compile_ci.yml +++ b/.github/workflows/v_apps_and_modules_compile_ci.yml @@ -41,7 +41,7 @@ jobs: - name: Test vsql compilation and examples run: | echo "Install vsql" - .github/workflows/retry.sh v install elliotchance.vsql ; cd ~/.vmodules/elliotchance/vsql + .github/workflows/retry.sh v install https://github.com/ttytm/vsql@temp/vi-ci ; cd ~/.vmodules/vsql echo "Generate vsql/grammar.v" make vsql/grammar.v echo "Compile vsql" @@ -53,10 +53,10 @@ jobs: - name: Test discord.v run: | - echo "Clone https://github.com/DarpHome/discord.v/" - .github/workflows/retry.sh git clone https://github.com/DarpHome/discord.v/ discord && cd discord - echo "Checkout last known good commit" - git checkout 533485c08f21df91ff62fea9477e7017d21f91c4 + echo "Clone https://github.com/DarpHome/discord.v" + .github/workflows/retry.sh v install https://github.com/ttytm/discord.v@temp/v-ci && cd ~/.vmodules/discord + # echo "Checkout last known good commit" + # git checkout 789de8ad35ee2683fbcd950fc07936f052088d0c echo "Execute Tests" v test . diff --git a/examples/pendulum-simulation/modules/sim/args/parser.v b/examples/pendulum-simulation/modules/sim/args/parser.v index f3668aabe4b1c3..230f07dd6ff3ca 100644 --- a/examples/pendulum-simulation/modules/sim/args/parser.v +++ b/examples/pendulum-simulation/modules/sim/args/parser.v @@ -11,6 +11,7 @@ const max_parallel_workers = runtime.nr_jobs() @[params] pub struct ParserSettings { +pub: sequential bool img bool extra_workers int diff --git a/examples/pendulum-simulation/modules/sim/params.v b/examples/pendulum-simulation/modules/sim/params.v index 643f3cec49016a..827146e7ac0d53 100644 --- a/examples/pendulum-simulation/modules/sim/params.v +++ b/examples/pendulum-simulation/modules/sim/params.v @@ -11,6 +11,7 @@ pub const default_gravity = 4.9 @[params] pub struct SimParams { +pub: rope_length f64 = sim.default_rope_length bearing_mass f64 = sim.default_bearing_mass magnet_spacing f64 = sim.default_magnet_spacing diff --git a/examples/pendulum-simulation/modules/sim/sim.v b/examples/pendulum-simulation/modules/sim/sim.v index 6034d44fe4c04b..e628033f75332d 100644 --- a/examples/pendulum-simulation/modules/sim/sim.v +++ b/examples/pendulum-simulation/modules/sim/sim.v @@ -1,7 +1,7 @@ module sim pub struct SimState { -mut: +pub mut: position Vector3D velocity Vector3D accel Vector3D diff --git a/examples/pendulum-simulation/modules/sim/vec.v b/examples/pendulum-simulation/modules/sim/vec.v index 3ad345125cfb2d..0e8f15de6485a2 100644 --- a/examples/pendulum-simulation/modules/sim/vec.v +++ b/examples/pendulum-simulation/modules/sim/vec.v @@ -4,6 +4,7 @@ import math // Vector3D is a 3D vector pub struct Vector3D { +pub: x f64 y f64 z f64 diff --git a/examples/pendulum-simulation/modules/sim/worker.v b/examples/pendulum-simulation/modules/sim/worker.v index 0263c7bf9c904b..09c09afe3a501c 100644 --- a/examples/pendulum-simulation/modules/sim/worker.v +++ b/examples/pendulum-simulation/modules/sim/worker.v @@ -7,10 +7,10 @@ const max_iterations = 1000 const simulation_delta_t = 0.0005 pub struct SimRequest { +pub: params SimParams state SimState -pub: - id int + id int } pub struct SimResult { diff --git a/examples/sokol/particles/modules/particle/particle.v b/examples/sokol/particles/modules/particle/particle.v index b2f7439efb8c18..5a19284fcf5f08 100644 --- a/examples/sokol/particles/modules/particle/particle.v +++ b/examples/sokol/particles/modules/particle/particle.v @@ -27,7 +27,7 @@ fn remap(v f64, min f64, max f64, new_min f64, new_max f64) f64 { // Particle pub struct Particle { -mut: +pub mut: location vec.Vec2[f64] velocity vec.Vec2[f64] acceleration vec.Vec2[f64] diff --git a/examples/sokol/particles/modules/particle/system.v b/examples/sokol/particles/modules/particle/system.v index c6035cc4434621..c1e2e491f59e8a 100644 --- a/examples/sokol/particles/modules/particle/system.v +++ b/examples/sokol/particles/modules/particle/system.v @@ -7,10 +7,12 @@ import rand import sokol.sgl pub struct SystemConfig { +pub: pool int } pub struct System { +pub: width int height int mut: diff --git a/examples/vweb/vweb_websocket/vweb_websocket.v b/examples/vweb/vweb_websocket/vweb_websocket.v index b80ad003bbffa1..015a6dec7586b9 100644 --- a/examples/vweb/vweb_websocket/vweb_websocket.v +++ b/examples/vweb/vweb_websocket/vweb_websocket.v @@ -40,11 +40,9 @@ fn new_app() !&App { } fn new_websocker_server() !&websocket.Server { - mut wss := &websocket.Server{ - logger: &log.Log{ - level: .debug - } - } + mut logger := &log.Log{} + logger.set_level(.debug) + mut wss := websocket.new_server(.ip, 8080, '', logger: logger) wss.on_connect(fn (mut server_client websocket.ServerClient) !bool { slog('ws.on_connect, server_client.client_key: ${server_client.client_key}') return true diff --git a/vlib/arrays/arrays.v b/vlib/arrays/arrays.v index 0d7b6485bf1964..15f0064755a4e1 100644 --- a/vlib/arrays/arrays.v +++ b/vlib/arrays/arrays.v @@ -182,6 +182,7 @@ pub fn chunk[T](array []T, size int) [][]T { } pub struct WindowAttribute { +pub: size int step int = 1 } diff --git a/vlib/benchmark/benchmark.v b/vlib/benchmark/benchmark.v index 58ee4b171248dc..b0f4b4d03666e0 100644 --- a/vlib/benchmark/benchmark.v +++ b/vlib/benchmark/benchmark.v @@ -153,6 +153,7 @@ pub fn (mut b Benchmark) record_measure(label string) i64 { // If it is set, the preparation time (compile time) will be shown before the measured runtime. @[params] pub struct MessageOptions { +pub: preparation time.Duration // the duration of the preparation time for the step } diff --git a/vlib/cli/flag_test.v b/vlib/cli/flag_test.v index a40a7c07af8229..034a451097f854 100644 --- a/vlib/cli/flag_test.v +++ b/vlib/cli/flag_test.v @@ -25,21 +25,6 @@ fn test_if_string_flag_parses() { flag.parse(['-flag=value2'], false) or { panic(err) } mut values := flag.get_strings() or { panic(err) } assert values == ['value1', 'value2'] - - flags := [ - cli.Flag{ - flag: .string_array - name: 'flag' - value: ['a', 'b', 'c'] - }, - cli.Flag{ - flag: .string - name: 'flag2' - }, - ] - - values = flags.get_strings('flag') or { panic(err) } - assert values == ['a', 'b', 'c'] } fn test_if_bool_flag_parses() { @@ -94,21 +79,6 @@ fn test_if_int_flag_parses() { flag.parse(['-flag=45'], false) or { panic(err) } mut values := flag.get_ints() or { panic(err) } assert values == [42, 45] - - flags := [ - cli.Flag{ - flag: .int_array - name: 'flag' - value: ['1', '2', '3'] - }, - cli.Flag{ - flag: .int - name: 'flag2' - }, - ] - - values = flags.get_ints('flag') or { panic(err) } - assert values == [1, 2, 3] } fn test_if_float_flag_parses() { @@ -139,21 +109,6 @@ fn test_if_float_flag_parses() { flag.parse(['-flag=1.3'], false) or { panic(err) } mut values := flag.get_floats() or { panic(err) } assert values == [3.1, 1.3] - - flags := [ - cli.Flag{ - flag: .float_array - name: 'flag' - value: ['1.1', '2.2', '3.3'] - }, - cli.Flag{ - flag: .float - name: 'flag2' - }, - ] - - values = flags.get_floats('flag') or { panic(err) } - assert values == [1.1, 2.2, 3.3] } fn test_if_flag_parses_with_abbrev() { diff --git a/vlib/compress/gzip/gzip.v b/vlib/compress/gzip/gzip.v index ec7f0bd6e05700..992a83192fc273 100644 --- a/vlib/compress/gzip/gzip.v +++ b/vlib/compress/gzip/gzip.v @@ -42,6 +42,7 @@ pub fn compress(data []u8) ![]u8 { @[params] pub struct DecompressParams { +pub: verify_header_checksum bool = true verify_length bool = true verify_checksum bool = true diff --git a/vlib/compress/szip/szip.c.v b/vlib/compress/szip/szip.c.v index 3de8314069ef3c..b224756aabdf24 100644 --- a/vlib/compress/szip/szip.c.v +++ b/vlib/compress/szip/szip.c.v @@ -7,6 +7,7 @@ import os @[params] pub struct ZipFolderOptions { +pub: omit_empty_folders bool } diff --git a/vlib/compress/zstd/zstd.v b/vlib/compress/zstd/zstd.v index 888514876e28c8..44b3fbaccdd6e8 100644 --- a/vlib/compress/zstd/zstd.v +++ b/vlib/compress/zstd/zstd.v @@ -390,6 +390,7 @@ pub fn default_c_level() int { @[params] pub struct CompressParams { +pub: compression_level int // 1~22 nb_threads int = 1 // how many threads will be spawned to compress in parallel checksum_flag bool = true @@ -422,6 +423,7 @@ pub fn compress(data []u8, params CompressParams) ![]u8 { @[params] pub struct DecompressParams { +pub: window_log_max int } diff --git a/vlib/dl/loader/loader.v b/vlib/dl/loader/loader.v index 3e0c9ea7564a30..a5be5dc4e43dfd 100644 --- a/vlib/dl/loader/loader.v +++ b/vlib/dl/loader/loader.v @@ -53,6 +53,7 @@ mut: // DynamicLibLoaderConfig is a configuration for DynamicLibLoader. @[params] pub struct DynamicLibLoaderConfig { +pub: // flags is the flags for dlopen. flags int = dl.rtld_lazy // key is the key to register the DynamicLibLoader. diff --git a/vlib/dlmalloc/dlmalloc.v b/vlib/dlmalloc/dlmalloc.v index eb2903785fb6ff..069faa3a85ee6f 100644 --- a/vlib/dlmalloc/dlmalloc.v +++ b/vlib/dlmalloc/dlmalloc.v @@ -205,6 +205,7 @@ fn overhead_for(c &Chunk) usize { // // Why not `interface?` Interfaces require memory allocation so it is simpler to pass a struct. pub struct Allocator { +pub: alloc fn (voidptr, usize) (voidptr, usize, u32) = unsafe { nil } remap fn (voidptr, voidptr, usize, usize, bool) voidptr = unsafe { nil } free_part fn (voidptr, voidptr, usize, usize) bool = unsafe { nil } diff --git a/vlib/encoding/csv/README_csv_reader.md b/vlib/encoding/csv/README_csv_reader.md index 912918306f037c..2e55133b40e192 100644 --- a/vlib/encoding/csv/README_csv_reader.md +++ b/vlib/encoding/csv/README_csv_reader.md @@ -42,6 +42,7 @@ Using these structs, it is possible to change the behavior of the CSV Reader. The config struct is as follows: ```v ignore pub struct SequentialReaderConfig { +pub: scr_buf voidptr // pointer to the buffer of data scr_buf_len i64 // if > 0 use the RAM pointed by scr_buf as source of data file_path string @@ -128,6 +129,7 @@ Using these structs, it is possible to change the behavior of the CSV Reader. The config struct is as follows: ```v ignore pub struct RandomAccessReaderConfig { +pub: scr_buf voidptr // pointer to the buffer of data scr_buf_len i64 // if > 0 use the RAM pointed from scr_buf as source of data file_path string diff --git a/vlib/encoding/csv/csv_reader_random_access.v b/vlib/encoding/csv/csv_reader_random_access.v index 9bf3c1eed47831..f9d79fc0607107 100644 --- a/vlib/encoding/csv/csv_reader_random_access.v +++ b/vlib/encoding/csv/csv_reader_random_access.v @@ -80,6 +80,7 @@ pub mut: @[params] pub struct RandomAccessReaderConfig { +pub: scr_buf voidptr // pointer to the buffer of data scr_buf_len i64 // if > 0 use the RAM pointed from scr_buf as source of data file_path string @@ -344,6 +345,7 @@ pub fn (mut cr RandomAccessReader) get_row(y int) ![]string { @[params] pub struct GetCellConfig { +pub: x int y int } @@ -444,6 +446,7 @@ pub fn (mut cr RandomAccessReader) get_cellt(cfg GetCellConfig) !CellValue { ******************************************************************************/ @[params] pub struct GetHeaderConf { +pub: header_row int // row where to inspect the header } diff --git a/vlib/encoding/csv/csv_reader_sequential.v b/vlib/encoding/csv/csv_reader_sequential.v index c117c3c5c966b6..ea1325876bdc57 100644 --- a/vlib/encoding/csv/csv_reader_sequential.v +++ b/vlib/encoding/csv/csv_reader_sequential.v @@ -13,6 +13,7 @@ import os @[params] pub struct SequentialReaderConfig { +pub: scr_buf voidptr // pointer to the buffer of data scr_buf_len i64 // if > 0 use the RAM pointed by scr_buf as source of data file_path string diff --git a/vlib/encoding/csv/reader.v b/vlib/encoding/csv/reader.v index d94cdf60275831..6d0132b77ea267 100644 --- a/vlib/encoding/csv/reader.v +++ b/vlib/encoding/csv/reader.v @@ -52,6 +52,7 @@ mut: @[params] pub struct ReaderConfig { +pub: delimiter u8 = `,` comment u8 = `#` } diff --git a/vlib/encoding/csv/writer.v b/vlib/encoding/csv/writer.v index e28660ad50367b..c36e845fcc304a 100644 --- a/vlib/encoding/csv/writer.v +++ b/vlib/encoding/csv/writer.v @@ -14,6 +14,7 @@ mut: @[params] pub struct WriterConfig { +pub: use_crlf bool delimiter u8 = `,` } diff --git a/vlib/encoding/html/escape.v b/vlib/encoding/html/escape.v index 28a537230c50a5..422726a10d4c7c 100644 --- a/vlib/encoding/html/escape.v +++ b/vlib/encoding/html/escape.v @@ -5,12 +5,14 @@ import strconv @[params] pub struct EscapeConfig { +pub: quote bool = true } @[params] pub struct UnescapeConfig { EscapeConfig +pub: all bool } diff --git a/vlib/encoding/xml/entity.v b/vlib/encoding/xml/entity.v index cb77b6e44068c4..34ce49ced75c1d 100644 --- a/vlib/encoding/xml/entity.v +++ b/vlib/encoding/xml/entity.v @@ -20,6 +20,7 @@ pub const default_entities_reverse = { @[params] pub struct EscapeConfig { +pub: reverse_entities map[string]string = xml.default_entities_reverse } @@ -38,6 +39,7 @@ pub fn escape_text(content string, config EscapeConfig) string { @[params] pub struct UnescapeConfig { +pub: entities map[string]string = xml.default_entities } diff --git a/vlib/encoding/xml/types.v b/vlib/encoding/xml/types.v index 7c013971f35f2d..830eaff5627097 100644 --- a/vlib/encoding/xml/types.v +++ b/vlib/encoding/xml/types.v @@ -37,21 +37,25 @@ pub: pub type DTDListItem = DTDElement | DTDEntity pub struct DTDEntity { +pub: name string @[required] value string @[required] } pub struct DTDElement { +pub: name string @[required] definition []string @[required] } pub struct DocumentTypeDefinition { +pub: name string list []DTDListItem } pub struct DocumentType { +pub: name string @[required] dtd DTDInfo } diff --git a/vlib/gg/draw.c.v b/vlib/gg/draw.c.v index 64ae5073b6aea4..6dfd5011bec9d2 100644 --- a/vlib/gg/draw.c.v +++ b/vlib/gg/draw.c.v @@ -226,6 +226,7 @@ pub enum PaintStyle { @[params] pub struct DrawRectParams { +pub: x f32 y f32 w f32 diff --git a/vlib/gg/gg.c.v b/vlib/gg/gg.c.v index 62661c2b5dbd35..58d3658288b89f 100644 --- a/vlib/gg/gg.c.v +++ b/vlib/gg/gg.c.v @@ -545,6 +545,7 @@ pub enum EndEnum { @[params] pub struct EndOptions { +pub: how EndEnum } diff --git a/vlib/gg/image.c.v b/vlib/gg/image.c.v index e6cf685376cc67..7edc083e2c908c 100644 --- a/vlib/gg/image.c.v +++ b/vlib/gg/image.c.v @@ -270,6 +270,7 @@ pub fn (mut ctx Context) create_image_from_byte_array(b []u8) !Image { } pub struct StreamingImageConfig { +pub: pixel_format gfx.PixelFormat = .rgba8 wrap_u gfx.Wrap = .clamp_to_edge wrap_v gfx.Wrap = .clamp_to_edge diff --git a/vlib/gg/text_rendering.c.v b/vlib/gg/text_rendering.c.v index 4781e05fd7b3e8..27e37b1e34f3a6 100644 --- a/vlib/gg/text_rendering.c.v +++ b/vlib/gg/text_rendering.c.v @@ -166,6 +166,7 @@ pub fn (ctx &Context) set_text_cfg(cfg gx.TextCfg) { @[params] pub struct DrawTextParams { +pub: x int y int text string diff --git a/vlib/io/buffered_reader.v b/vlib/io/buffered_reader.v index 968ab643190d18..d219ce49aea376 100644 --- a/vlib/io/buffered_reader.v +++ b/vlib/io/buffered_reader.v @@ -16,6 +16,7 @@ pub mut: // BufferedReaderConfig are options that can be given to a buffered reader. pub struct BufferedReaderConfig { +pub: reader Reader cap int = 128 * 1024 // large for fast reading of big(ish) files retries int = 2 // how many times to retry before assuming the stream ended diff --git a/vlib/io/reader.v b/vlib/io/reader.v index efd705bbfa338c..3bf1e7b835c10b 100644 --- a/vlib/io/reader.v +++ b/vlib/io/reader.v @@ -35,9 +35,9 @@ pub const read_all_grow_len = 1024 // ReadAllConfig allows options to be passed for the behaviour // of read_all. pub struct ReadAllConfig { +pub: read_to_end_of_stream bool -mut: - reader Reader + reader Reader } // read_all reads all bytes from a reader until either a 0 length read diff --git a/vlib/io/string_reader/string_reader.v b/vlib/io/string_reader/string_reader.v index 7e0ecbc7354e60..6fb53fb1921788 100644 --- a/vlib/io/string_reader/string_reader.v +++ b/vlib/io/string_reader/string_reader.v @@ -5,6 +5,7 @@ import strings @[params] pub struct StringReaderParams { +pub: // the reader interface reader ?io.Reader // initialize the builder with this source string diff --git a/vlib/io/util/util.v b/vlib/io/util/util.v index 2006ad3c30f7a7..5db3e7d7c3031d 100644 --- a/vlib/io/util/util.v +++ b/vlib/io/util/util.v @@ -7,6 +7,7 @@ const retries = 10000 @[params] pub struct TempFileOptions { +pub: path string = os.temp_dir() pattern string } @@ -40,6 +41,7 @@ pub fn temp_file(tfo TempFileOptions) !(os.File, string) { @[params] pub struct TempDirOptions { +pub: path string = os.temp_dir() pattern string } diff --git a/vlib/log/file_log_test.v b/vlib/log/file_log_test.v index 434d89512ebf86..6ffcf70d1c9e81 100644 --- a/vlib/log/file_log_test.v +++ b/vlib/log/file_log_test.v @@ -49,9 +49,8 @@ fn test_set_always_flush() { os.rmdir_all(lfolder) or {} } dump(lfolder) - mut l := log.Log{ - level: .info - } + mut l := log.Log{} + l.set_level(.info) l.set_full_logpath(lpath1) l.set_always_flush(true) l.warn('one warning') diff --git a/vlib/math/big/integer.v b/vlib/math/big/integer.v index ae809dfa5088c7..b84876bc1b88af 100644 --- a/vlib/math/big/integer.v +++ b/vlib/math/big/integer.v @@ -117,6 +117,7 @@ pub fn integer_from_u64(value u64) Integer { @[params] pub struct IntegerConfig { +pub: signum int = 1 } diff --git a/vlib/math/math.v b/vlib/math/math.v index 3d194cceb28152..888d83dfaa3e81 100644 --- a/vlib/math/math.v +++ b/vlib/math/math.v @@ -53,6 +53,7 @@ pub fn angle_diff(radian_a f64, radian_b f64) f64 { @[params] pub struct DigitParams { +pub: base int = 10 reverse bool } diff --git a/vlib/net/common.c.v b/vlib/net/common.c.v index db64eac5c87657..e07f860c414864 100644 --- a/vlib/net/common.c.v +++ b/vlib/net/common.c.v @@ -26,6 +26,7 @@ pub enum ShutdownDirection { @[params] pub struct ShutdownConfig { +pub: how ShutdownDirection = .read_and_write } diff --git a/vlib/net/html/dom.v b/vlib/net/html/dom.v index 7e8a991cbe18af..92624ef58cebc8 100644 --- a/vlib/net/html/dom.v +++ b/vlib/net/html/dom.v @@ -23,6 +23,7 @@ mut: @[params] pub struct GetTagsOptions { +pub: name string } diff --git a/vlib/net/http/header.v b/vlib/net/http/header.v index 8d963bb7ad956c..2ce6f067b3639a 100644 --- a/vlib/net/http/header.v +++ b/vlib/net/http/header.v @@ -15,9 +15,10 @@ pub const max_headers = 50 // Header represents the key-value pairs in an HTTP header pub struct Header { -mut: +pub mut: // data map[string][]string - data [max_headers]HeaderKV + data [max_headers]HeaderKV +mut: cur_pos int // map of lowercase header keys to their original keys // in order of appearance @@ -352,6 +353,7 @@ pub fn (mut h Header) free() { } pub struct HeaderConfig { +pub: key CommonHeader value string } @@ -490,6 +492,7 @@ pub fn (mut h Header) delete_custom(key string) { @[params] pub struct HeaderCoerceConfig { +pub: canonicalize bool } @@ -553,6 +556,7 @@ pub fn (h Header) contains(key CommonHeader) bool { @[params] pub struct HeaderQueryConfig { +pub: exact bool } @@ -666,6 +670,7 @@ pub fn (h Header) keys() []string { @[params] pub struct HeaderRenderConfig { +pub: version Version coerce bool canonicalize bool diff --git a/vlib/net/http/request.v b/vlib/net/http/request.v index 9b6af6fa653a1d..12a2da53f16b6c 100644 --- a/vlib/net/http/request.v +++ b/vlib/net/http/request.v @@ -388,6 +388,7 @@ pub: pub struct UnexpectedExtraAttributeError { Error +pub: attributes []string } diff --git a/vlib/net/http/response.v b/vlib/net/http/response.v index 6ec143c1dd55e3..e79ce01f3ad6c4 100644 --- a/vlib/net/http/response.v +++ b/vlib/net/http/response.v @@ -117,6 +117,7 @@ pub fn (mut r Response) set_version(v Version) { } pub struct ResponseConfig { +pub: version Version = .v1_1 status Status = .ok header Header diff --git a/vlib/net/mbedtls/ssl_connection.c.v b/vlib/net/mbedtls/ssl_connection.c.v index 452b14783a43d8..00fc0758892112 100644 --- a/vlib/net/mbedtls/ssl_connection.c.v +++ b/vlib/net/mbedtls/ssl_connection.c.v @@ -32,8 +32,9 @@ struct SSLCerts { // SSLConn is the current connection pub struct SSLConn { +pub: config SSLConnectConfig -mut: +pub mut: server_fd C.mbedtls_net_context ssl C.mbedtls_ssl_context conf C.mbedtls_ssl_config @@ -215,6 +216,7 @@ pub fn (mut l SSLListener) accept() !&SSLConn { @[params] pub struct SSLConnectConfig { +pub: verify string // the path to a rootca.pem file, containing trusted CA certificate(s) cert string // the path to a cert.pem file, containing client certificate(s) for the request cert_key string // the path to a key.pem file, containing private keys for the client certificate(s) diff --git a/vlib/net/openssl/ssl_connection.c.v b/vlib/net/openssl/ssl_connection.c.v index 4878496b6b4ea6..39cbce121c84c8 100644 --- a/vlib/net/openssl/ssl_connection.c.v +++ b/vlib/net/openssl/ssl_connection.c.v @@ -7,8 +7,9 @@ import os // SSLConn is the current connection pub struct SSLConn { +pub: config SSLConnectConfig -mut: +pub mut: sslctx &C.SSL_CTX = unsafe { nil } ssl &C.SSL = unsafe { nil } handle int @@ -19,6 +20,7 @@ mut: @[params] pub struct SSLConnectConfig { +pub: verify string // the path to a rootca.pem file, containing trusted CA certificate(s) cert string // the path to a cert.pem file, containing client certificate(s) for the request cert_key string // the path to a key.pem file, containing private keys for the client certificate(s) diff --git a/vlib/net/smtp/smtp.v b/vlib/net/smtp/smtp.v index d0069cc68fa351..b39e775a58fc25 100644 --- a/vlib/net/smtp/smtp.v +++ b/vlib/net/smtp/smtp.v @@ -47,6 +47,7 @@ pub mut: } pub struct Mail { +pub: from string to string cc string diff --git a/vlib/net/tcp.c.v b/vlib/net/tcp.c.v index 08af8b6bac298a..dd5380ed8c334c 100644 --- a/vlib/net/tcp.c.v +++ b/vlib/net/tcp.c.v @@ -9,8 +9,7 @@ pub const tcp_default_write_timeout = 30 * time.second @[heap] pub struct TcpConn { pub mut: - sock TcpSocket -mut: + sock TcpSocket handle int write_deadline time.Time read_deadline time.Time @@ -312,8 +311,7 @@ pub fn (c TcpConn) str() string { pub struct TcpListener { pub mut: - sock TcpSocket -mut: + sock TcpSocket accept_timeout time.Duration accept_deadline time.Time is_blocking bool = true diff --git a/vlib/net/unix/stream.c.v b/vlib/net/unix/stream.c.v index 40804e2d897ec8..d7f580706974ba 100644 --- a/vlib/net/unix/stream.c.v +++ b/vlib/net/unix/stream.c.v @@ -224,6 +224,7 @@ mut: @[params] pub struct ListenOptions { +pub: backlog int = 128 } diff --git a/vlib/net/websocket/utils.v b/vlib/net/websocket/utils.v index 27218f2eb27756..50feeffb30145d 100644 --- a/vlib/net/websocket/utils.v +++ b/vlib/net/websocket/utils.v @@ -4,6 +4,15 @@ import rand import crypto.sha1 import encoding.base64 import encoding.binary +import log + +const default_logger = setup_default_logger() + +fn setup_default_logger() &log.Log { + mut l := &log.Log{} + l.set_level(.info) + return l +} // htonl64 converts payload length to header bits fn htonl64(payload_len u64) []u8 { diff --git a/vlib/net/websocket/websocket_client.v b/vlib/net/websocket/websocket_client.v index acbd2060145daa..a28c041a4dce0c 100644 --- a/vlib/net/websocket/websocket_client.v +++ b/vlib/net/websocket/websocket_client.v @@ -43,9 +43,7 @@ pub mut: panic_on_callback bool // set to true of callbacks can panic client_state shared ClientState // current state of connection // logger used to log messages - logger &log.Logger = &log.Logger(&log.Log{ - level: .info -}) + logger &log.Logger = default_logger resource_name string // name of current resource last_pong_ut i64 // last time in unix time we got a pong message } @@ -84,11 +82,10 @@ pub enum OPCode { @[params] pub struct ClientOpt { +pub: read_timeout i64 = 30 * time.second write_timeout i64 = 30 * time.second - logger &log.Logger = &log.Logger(&log.Log{ - level: .info -}) + logger &log.Logger = default_logger } // new_client instance a new websocket client diff --git a/vlib/net/websocket/websocket_server.v b/vlib/net/websocket/websocket_server.v index 3995f9fee0066b..86b7aa42796d95 100644 --- a/vlib/net/websocket/websocket_server.v +++ b/vlib/net/websocket/websocket_server.v @@ -17,9 +17,7 @@ pub mut: // Server represents a websocket server connection pub struct Server { mut: - logger &log.Logger = &log.Logger(&log.Log{ - level: .info -}) + logger &log.Logger = default_logger ls &net.TcpListener = unsafe { nil } // listener used to get incoming connection to socket accept_client_callbacks []AcceptClientFn // accept client callback functions message_callbacks []MessageEventHandler // new message callback functions @@ -44,9 +42,8 @@ pub mut: @[params] pub struct ServerOpt { - logger &log.Logger = &log.Logger(&log.Log{ - level: .info -}) +pub: + logger &log.Logger = default_logger } // new_server instance a new websocket server on provided port and route @@ -143,13 +140,13 @@ fn (mut s Server) serve_client(mut c Client) ! { // handle_handshake use an existing connection to respond to the handshake for a given key pub fn (mut s Server) handle_handshake(mut conn net.TcpConn, key string) !&ServerClient { + mut logger := &log.Log{} + logger.set_level(.debug) mut c := &Client{ is_server: true conn: conn is_ssl: false - logger: &log.Log{ - level: .debug - } + logger: logger client_state: ClientState{ state: .open } diff --git a/vlib/os/fd.c.v b/vlib/os/fd.c.v index a8f3855f056748..e94f88e08cf09f 100644 --- a/vlib/os/fd.c.v +++ b/vlib/os/fd.c.v @@ -75,6 +75,7 @@ pub fn fd_read(fd int, maxbytes int) (string, int) { pub struct C.fd_set {} pub struct C.timeval { +pub: tv_sec u64 tv_usec u64 } diff --git a/vlib/os/os.v b/vlib/os/os.v index 314f74befb14ff..ae81e6a3029cf1 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -121,6 +121,7 @@ pub fn cp_all(src string, dst string, overwrite bool) ! { @[params] pub struct MvParams { +pub: overwrite bool = true } @@ -717,6 +718,7 @@ pub fn log(s string) { @[params] pub struct MkdirParams { +pub: mode u32 = 0o777 // note that the actual mode is affected by the process's umask } diff --git a/vlib/readline/readline.v b/vlib/readline/readline.v index 6b9c632b8e09fe..8636d53b1b10fd 100644 --- a/vlib/readline/readline.v +++ b/vlib/readline/readline.v @@ -20,7 +20,7 @@ struct Winsize { // Readline is the key struct for reading and holding user input via a terminal. // Example: import readline { Readline } pub struct Readline { -mut: +pub mut: is_raw bool orig_termios termios.Termios // Linux current []rune // Line being edited diff --git a/vlib/sokol/audio/audio.c.v b/vlib/sokol/audio/audio.c.v index 48cdba2d3c451f..7d540a63df78e2 100644 --- a/vlib/sokol/audio/audio.c.v +++ b/vlib/sokol/audio/audio.c.v @@ -83,6 +83,7 @@ pub mut: // | num_packets | 64 | for push model only, number of packets in the backend ringbuffer | @[typedef] pub struct C.saudio_desc { +pub: sample_rate int num_channels int buffer_frames int diff --git a/vlib/sync/pool/pool.c.v b/vlib/sync/pool/pool.c.v index 6c962ef4370c18..02a5cf68f756c9 100644 --- a/vlib/sync/pool/pool.c.v +++ b/vlib/sync/pool/pool.c.v @@ -29,6 +29,7 @@ fn empty_cb(mut p PoolProcessor, idx int, task_id int) voidptr { } pub struct PoolProcessorConfig { +pub: maxjobs int callback ThreadCB = empty_cb } diff --git a/vlib/szip/szip.c.v b/vlib/szip/szip.c.v index 8aca2287999431..0150b4db86e54f 100644 --- a/vlib/szip/szip.c.v +++ b/vlib/szip/szip.c.v @@ -9,6 +9,7 @@ import os @[params] pub struct ZipFolderOptions { +pub: omit_empty_folders bool } diff --git a/vlib/term/ui/input.v b/vlib/term/ui/input.v index d2ec81da9e952d..d1bf7dd20feb10 100644 --- a/vlib/term/ui/input.v +++ b/vlib/term/ui/input.v @@ -183,6 +183,7 @@ pub mut: } pub struct Config { +pub: user_data voidptr init_fn ?fn (voidptr) frame_fn ?fn (voidptr) diff --git a/vlib/time/stopwatch.v b/vlib/time/stopwatch.v index 328acff911203e..43dcb4cd506ab4 100644 --- a/vlib/time/stopwatch.v +++ b/vlib/time/stopwatch.v @@ -5,6 +5,7 @@ module time @[params] pub struct StopWatchOptions { +pub: auto_start bool = true } diff --git a/vlib/time/time.c.v b/vlib/time/time.c.v index 2bdb792bf2a5b3..9f43f4436f8d57 100644 --- a/vlib/time/time.c.v +++ b/vlib/time/time.c.v @@ -7,6 +7,7 @@ module time // C.timeval represents a C time value. pub struct C.timeval { +pub: tv_sec u64 tv_usec u64 } diff --git a/vlib/time/time_nix.c.v b/vlib/time/time_nix.c.v index 2e204fa482ff6a..d48080187a6507 100644 --- a/vlib/time/time_nix.c.v +++ b/vlib/time/time_nix.c.v @@ -42,7 +42,7 @@ pub fn (t Time) local() Time { // in most systems, these are __quad_t, which is an i64 pub struct C.timespec { -mut: +pub mut: tv_sec i64 tv_nsec i64 } diff --git a/vlib/time/time_windows.c.v b/vlib/time/time_windows.c.v index 0f381ab68aa437..8b79c8f6b3702b 100644 --- a/vlib/time/time_windows.c.v +++ b/vlib/time/time_windows.c.v @@ -48,6 +48,7 @@ const start_local_time = local_as_unix_time() // in most systems, these are __quad_t, which is an i64 pub struct C.timespec { +pub: tv_sec i64 tv_nsec i64 } diff --git a/vlib/toml/checker/checker.v b/vlib/toml/checker/checker.v index 129145042098ee..3262e3d93f43b9 100644 --- a/vlib/toml/checker/checker.v +++ b/vlib/toml/checker/checker.v @@ -19,6 +19,7 @@ const utf8_max = 0x10FFFF // Checker checks a tree of TOML `ast.Value`'s for common errors. pub struct Checker { +pub: scanner &scanner.Scanner = unsafe { nil } } diff --git a/vlib/toml/decoder/decoder.v b/vlib/toml/decoder/decoder.v index dd432b84c26837..603427da0d29ef 100644 --- a/vlib/toml/decoder/decoder.v +++ b/vlib/toml/decoder/decoder.v @@ -14,6 +14,7 @@ const utf8_max = 0x10FFFF // Decoder decode special sequences in a tree of TOML `ast.Value`'s. pub struct Decoder { +pub: scanner &scanner.Scanner = unsafe { nil } } diff --git a/vlib/toml/toml.v b/vlib/toml/toml.v index dc6e589a8d7b46..35dda7df835974 100644 --- a/vlib/toml/toml.v +++ b/vlib/toml/toml.v @@ -203,6 +203,7 @@ fn to_any[T](value T) Any { // DateTime is the representation of an RFC 3339 datetime string. pub struct DateTime { +pub: datetime string } @@ -213,6 +214,7 @@ pub fn (dt DateTime) str() string { // Date is the representation of an RFC 3339 date-only string. pub struct Date { +pub: date string } @@ -223,6 +225,7 @@ pub fn (d Date) str() string { // Time is the representation of an RFC 3339 time-only string. pub struct Time { +pub: time string } diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index 59b613683e597e..ed6b8fc0052bec 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -289,6 +289,7 @@ pub fn (t &Table) find_method(s &TypeSymbol, name string) !Fn { @[params] pub struct GetEmbedsOptions { +pub: preceding []Type } diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 1cc6616590d0fb..540d1e5f93e622 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -1512,6 +1512,7 @@ fn (t Table) shorten_user_defined_typenames(original_name string, import_aliases @[minify] pub struct FnSignatureOpts { +pub: skip_receiver bool type_only bool } diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 2c0ec42b872674..af455f7bb2c8f2 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -740,11 +740,30 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.', for i, mut field in fields { if field.name in inited_fields { - if c.mod != type_sym.mod && field.is_deprecated { - for init_field in node.init_fields { - if field.name == init_field.name { - c.deprecate('field', field.name, field.attrs, init_field.pos) - break + if c.mod != type_sym.mod { + if !field.is_pub { + parts := type_sym.name.split('.') + for init_field in node.init_fields { + if field.name == init_field.name { + mod_type := if parts.len > 1 { + parts#[-2..].join('.') + } else { + parts.last() + } + c.add_error_detail('this will become an error after 2024-05-31') + c.warn('initalizing private field `${field.name}` of `${mod_type}`', + init_field.pos) + // c.error('cannot access private field `${field.name}` on `${mod_type}`', init_field.pos) + break + } + } + } + if field.is_deprecated { + for init_field in node.init_fields { + if field.name == init_field.name { + c.deprecate('field', field.name, field.attrs, init_field.pos) + break + } } } } diff --git a/vlib/v/checker/tests/amod/amod.v b/vlib/v/checker/tests/amod/amod.v index 5392fc0f2b6680..e67d2e9484435f 100644 --- a/vlib/v/checker/tests/amod/amod.v +++ b/vlib/v/checker/tests/amod/amod.v @@ -1,5 +1,17 @@ module amod -pub struct Xyz {} +pub struct Xyz { +pub: + x int +} -pub struct Bcg {} +pub struct Bcg { + x int +} + +@[params] +pub struct FooParams { + bar string +} + +pub fn foo(opts FooParams) {} diff --git a/vlib/v/checker/tests/modules/overload_return_type/point.v b/vlib/v/checker/tests/modules/overload_return_type/point.v index a26932bd41b22c..b34bc5c037ae1f 100644 --- a/vlib/v/checker/tests/modules/overload_return_type/point.v +++ b/vlib/v/checker/tests/modules/overload_return_type/point.v @@ -1,7 +1,7 @@ module point pub struct Point { -mut: +pub mut: x int y int } diff --git a/vlib/v/checker/tests/struct_field_private_err.out b/vlib/v/checker/tests/struct_field_private_err.out new file mode 100644 index 00000000000000..c9a44768379e74 --- /dev/null +++ b/vlib/v/checker/tests/struct_field_private_err.out @@ -0,0 +1,14 @@ +vlib/v/checker/tests/struct_field_private_err.vv:8:2: warning: initalizing private field `x` of `amod.Bcg` + 6 | + 7 | _ := amod.Bcg{ + 8 | x: 0 + | ~~~~ + 9 | } + 10 | +Details: this will become an error after 2024-05-31 +vlib/v/checker/tests/struct_field_private_err.vv:11:10: warning: initalizing private field `bar` of `amod.FooParams` + 9 | } + 10 | + 11 | amod.foo(bar: 'bar') + | ~~~~~~~~~~ +Details: this will become an error after 2024-05-31 diff --git a/vlib/v/checker/tests/struct_field_private_err.vv b/vlib/v/checker/tests/struct_field_private_err.vv new file mode 100644 index 00000000000000..d1a8f91c1c5fe1 --- /dev/null +++ b/vlib/v/checker/tests/struct_field_private_err.vv @@ -0,0 +1,11 @@ +import v.checker.tests.amod + +_ := amod.Xyz{ + x: 0 +} + +_ := amod.Bcg{ + x: 0 +} + +amod.foo(bar: 'bar') diff --git a/vlib/v/doc/doc_test.v b/vlib/v/doc/doc_test.v index 73ec7f27b42ab4..c315dfe289f1e2 100644 --- a/vlib/v/doc/doc_test.v +++ b/vlib/v/doc/doc_test.v @@ -41,6 +41,7 @@ pub enum MouseButtons { end_options := mod_doc.contents['EndOptions'] assert end_options.content == '@[params] pub struct EndOptions { +pub: how EndEnum }' assert end_options.attrs == { diff --git a/vlib/v/dotgraph/dotgraph.v b/vlib/v/dotgraph/dotgraph.v index 58532bf6105ac1..60d7c23f17bd80 100644 --- a/vlib/v/dotgraph/dotgraph.v +++ b/vlib/v/dotgraph/dotgraph.v @@ -35,6 +35,7 @@ pub fn (mut d DotGraph) finish() { // pub struct NewNodeConfig { +pub: node_name string should_highlight bool tooltip string @@ -57,6 +58,7 @@ pub fn (mut d DotGraph) new_node(nlabel string, cfg NewNodeConfig) { // pub struct NewEdgeConfig { +pub: should_highlight bool ctx voidptr = unsafe { nil } name2node_fn FnLabel2NodeName = node_name diff --git a/vlib/v/eval/eval.v b/vlib/v/eval/eval.v index 1175e3bd3d5d5a..f99fd29022b097 100644 --- a/vlib/v/eval/eval.v +++ b/vlib/v/eval/eval.v @@ -51,6 +51,7 @@ pub fn (mut e Eval) run(expression string, args ...Object) ![]Object { type Symbol = Object | ast.EmptyStmt | ast.FnDecl pub struct Eval { +pub: pref &pref.Preferences = unsafe { nil } pub mut: table &ast.Table = unsafe { nil } diff --git a/vlib/v/fmt/align.v b/vlib/v/fmt/align.v index d8dd3d3d673ca9..3c97ddf39aba1f 100644 --- a/vlib/v/fmt/align.v +++ b/vlib/v/fmt/align.v @@ -16,6 +16,7 @@ mut: @[params] struct AddInfoConfig { +pub: use_threshold bool } diff --git a/vlib/v/fmt/attrs.v b/vlib/v/fmt/attrs.v index 29ee96c822e4ff..be275c248c19dc 100644 --- a/vlib/v/fmt/attrs.v +++ b/vlib/v/fmt/attrs.v @@ -23,6 +23,7 @@ pub fn (mut f Fmt) attrs(attrs []ast.Attr) { @[params] pub struct AttrsOptions { +pub: same_line bool } diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index d2a7c187c4ef67..b40f3cfc1de12e 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -14,6 +14,7 @@ const bs = '\\' @[minify] pub struct Fmt { +pub: pref &pref.Preferences = unsafe { nil } pub mut: file ast.File @@ -56,6 +57,7 @@ pub mut: @[params] pub struct FmtOptions { +pub: source_text string } @@ -167,6 +169,7 @@ pub fn (mut f Fmt) wrap_long_line(penalty_idx int, add_indent bool) bool { @[params] pub struct RemoveNewLineConfig { +pub: imports_buffer bool // Work on f.out_imports instead of f.out } diff --git a/vlib/v/gen/golang/attrs.v b/vlib/v/gen/golang/attrs.v index 155d2cf5f42685..04520eb76e1461 100644 --- a/vlib/v/gen/golang/attrs.v +++ b/vlib/v/gen/golang/attrs.v @@ -23,6 +23,7 @@ pub fn (mut f Gen) attrs(attrs []ast.Attr) { @[params] pub struct AttrsOptions { +pub: inline bool } diff --git a/vlib/v/gen/golang/golang.v b/vlib/v/gen/golang/golang.v index ca742b952ceb39..084656e05b0ace 100644 --- a/vlib/v/gen/golang/golang.v +++ b/vlib/v/gen/golang/golang.v @@ -126,6 +126,7 @@ pub fn (mut f Gen) wrap_long_line(penalty_idx int, add_indent bool) bool { @[params] pub struct RemoveNewLineConfig { +pub: imports_buffer bool // Work on f.out_imports instead of f.out } diff --git a/vlib/v/gen/native/amd64.v b/vlib/v/gen/native/amd64.v index c395a4f80dff64..01c30ebb9a13ee 100644 --- a/vlib/v/gen/native/amd64.v +++ b/vlib/v/gen/native/amd64.v @@ -79,11 +79,13 @@ enum Amd64SetOp { @[params] struct AvailableAmd64Register { +pub: available Amd64Register } @[params] struct Amd64RegisterOption { +pub: reg Amd64Register = Amd64Register.rax ssereg Amd64SSERegister = Amd64SSERegister.xmm0 } diff --git a/vlib/v/gen/native/gen.v b/vlib/v/gen/native/gen.v index 25f80e5abfbea0..bec4bc960f33f9 100644 --- a/vlib/v/gen/native/gen.v +++ b/vlib/v/gen/native/gen.v @@ -231,6 +231,7 @@ struct GlobalVar {} @[params] struct VarConfig { +pub: offset i32 // offset from the variable typ ast.Type // type of the value you want to process e.g. struct fields. } diff --git a/vlib/v/gen/wasm/serialise/serialise.v b/vlib/v/gen/wasm/serialise/serialise.v index 560171796f780f..1f3a2146212447 100644 --- a/vlib/v/gen/wasm/serialise/serialise.v +++ b/vlib/v/gen/wasm/serialise/serialise.v @@ -103,6 +103,7 @@ pub fn (mut p Pool) type_size(typ ast.Type) (int, int) { @[params] pub struct PoolOpts { +pub: null_terminated bool = true intern_strings bool = true store_relocs bool = true diff --git a/vlib/v/help/help.v b/vlib/v/help/help.v index bcf9d39978dee8..5929b809b09862 100644 --- a/vlib/v/help/help.v +++ b/vlib/v/help/help.v @@ -21,6 +21,7 @@ fn help_dir() string { @[params] pub struct ExitOptions { +pub: exit_code int } diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 6de67cbc24ad69..ef8db91b69cfdf 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -21,6 +21,7 @@ const allowed_lock_prefix_ins = ['add', 'adc', 'and', 'btc', 'btr', 'bts', 'cmpx @[minify] pub struct Parser { +pub: pref &pref.Preferences = unsafe { nil } mut: file_base string // "hello.v" @@ -32,7 +33,6 @@ mut: tok token.Token prev_tok token.Token peek_tok token.Token - table &ast.Table = unsafe { nil } language ast.Language fn_language ast.Language // .c for `fn C.abcd()` declarations expr_level int // prevent too deep recursions for pathological programs @@ -70,17 +70,16 @@ mut: inside_orm bool inside_chan_decl bool inside_attr_decl bool - fixed_array_dim int // fixed array dim parsing level - or_is_handled bool // ignore `or` in this expression - builtin_mod bool // are we in the `builtin` module? - mod string // current module name - is_manualfree bool // true when `[manualfree] module abc`, makes *all* fns in the current .v file, opt out of autofree - has_globals bool // `[has_globals] module abc` - allow globals declarations, even without -enable-globals, in that single .v file __only__ - is_generated bool // `[generated] module abc` - turn off compiler notices for that single .v file __only__. - is_translated bool // `[translated] module abc` - mark a file as translated, to relax some compiler checks for translated code. - attrs []ast.Attr // attributes before next decl stmt - expr_mod string // for constructing full type names in parse_type() - scope &ast.Scope = unsafe { nil } + fixed_array_dim int // fixed array dim parsing level + or_is_handled bool // ignore `or` in this expression + builtin_mod bool // are we in the `builtin` module? + mod string // current module name + is_manualfree bool // true when `[manualfree] module abc`, makes *all* fns in the current .v file, opt out of autofree + has_globals bool // `[has_globals] module abc` - allow globals declarations, even without -enable-globals, in that single .v file __only__ + is_generated bool // `[generated] module abc` - turn off compiler notices for that single .v file __only__. + is_translated bool // `[translated] module abc` - mark a file as translated, to relax some compiler checks for translated code. + attrs []ast.Attr // attributes before next decl stmt + expr_mod string // for constructing full type names in parse_type() imports map[string]string // alias => mod_name ast_imports []ast.Import // mod_names used_imports []string // alias @@ -107,6 +106,8 @@ mut: script_mode_start_token token.Token pub mut: scanner &scanner.Scanner = unsafe { nil } + table &ast.Table = unsafe { nil } + scope &ast.Scope = unsafe { nil } errors []errors.Error warnings []errors.Warning notices []errors.Notice @@ -647,6 +648,7 @@ fn (mut p Parser) check(expected token.Kind) { @[params] struct ParamsForUnexpected { +pub: got string expecting string prepend_msg string @@ -929,6 +931,7 @@ fn (mut p Parser) comment_stmt() ast.ExprStmt { @[params] struct EatCommentsConfig { +pub: same_line bool // Only eat comments on the same line as the previous token follow_up bool // Comments directly below the previous token as long as there is no empty line } @@ -4647,6 +4650,7 @@ fn (mut p Parser) trace[T](fbase string, x &T) { @[params] struct ParserShowParams { +pub: msg string reach int = 3 } diff --git a/vlib/v/tests/generics_from_modules/newmodule/newmodule.v b/vlib/v/tests/generics_from_modules/newmodule/newmodule.v index 9ab2ca6c00d61b..f8ca00ab99439a 100644 --- a/vlib/v/tests/generics_from_modules/newmodule/newmodule.v +++ b/vlib/v/tests/generics_from_modules/newmodule/newmodule.v @@ -1,7 +1,7 @@ module newmodule pub struct Params[T] { -mut: +pub mut: a []T b int c T diff --git a/vlib/v/trace_calls/tracing_calls_nix.c.v b/vlib/v/trace_calls/tracing_calls_nix.c.v index 686296038ad4d3..013d3bd536b2f8 100644 --- a/vlib/v/trace_calls/tracing_calls_nix.c.v +++ b/vlib/v/trace_calls/tracing_calls_nix.c.v @@ -1,7 +1,7 @@ module trace_calls pub struct C.timespec { -mut: +pub mut: tv_sec i64 tv_nsec i64 } diff --git a/vlib/v/util/timers.v b/vlib/v/util/timers.v index 30771eb7ec68bb..78c722f13be87b 100644 --- a/vlib/v/util/timers.v +++ b/vlib/v/util/timers.v @@ -20,6 +20,7 @@ pub mut: @[params] pub struct TimerParams { +pub: should_print bool label string } diff --git a/vlib/v/util/vtest/vtest.v b/vlib/v/util/vtest/vtest.v index 4c53684d2d217a..36045cfe34eeb9 100644 --- a/vlib/v/util/vtest/vtest.v +++ b/vlib/v/util/vtest/vtest.v @@ -4,6 +4,7 @@ import os @[params] pub struct FilterVTestConfig { +pub: basepath string fix_slashes bool = true } diff --git a/vlib/vweb/sse/sse.v b/vlib/vweb/sse/sse.v index becf26964f3f14..5ddf434ad8f87a 100644 --- a/vlib/vweb/sse/sse.v +++ b/vlib/vweb/sse/sse.v @@ -29,6 +29,7 @@ pub mut: } pub struct SSEMessage { +pub: id string event string data string diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index f8603d2c011701..0488b32217364f 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -321,6 +321,7 @@ pub fn (mut ctx Context) server_error(ecode int) Result { @[params] pub struct RedirectParams { +pub: status_code int = 302 } @@ -523,6 +524,7 @@ pub fn run[T](global_app &T, port int) { @[params] pub struct RunParams { +pub: family net.AddrFamily = .ip6 // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1 host string port int = 8080 @@ -1215,6 +1217,7 @@ fn (mut w Worker[T]) process_incoming_requests() { @[params] pub struct PoolParams[T] { +pub: handler fn () T = unsafe { nil } @[required] nr_workers int = runtime.nr_jobs() } diff --git a/vlib/x/json2/encoder.v b/vlib/x/json2/encoder.v index f570dc9c12735f..3e2f85fa0ed171 100644 --- a/vlib/x/json2/encoder.v +++ b/vlib/x/json2/encoder.v @@ -8,6 +8,7 @@ import time // Encoder encodes the an `Any` type into JSON representation. // It provides parameters in order to change the end result. pub struct Encoder { +pub: newline u8 newline_spaces_count int escape_unicode bool = true diff --git a/vlib/x/json2/strict/strict.v b/vlib/x/json2/strict/strict.v index 42c71173eb9cfa..fca3bdf45e5143 100644 --- a/vlib/x/json2/strict/strict.v +++ b/vlib/x/json2/strict/strict.v @@ -16,6 +16,7 @@ pub enum KeyType { } pub struct StructCheckResult { +pub: duplicates []string superfluous []string } diff --git a/vlib/x/sessions/sessions.v b/vlib/x/sessions/sessions.v index 95cbd879dd6cb6..1cf472ed792cd4 100644 --- a/vlib/x/sessions/sessions.v +++ b/vlib/x/sessions/sessions.v @@ -54,6 +54,7 @@ pub mut: // CookieOptions contains the default settings for the cookie created in // the `Sessions` struct. pub struct CookieOptions { +pub: cookie_name string = 'sid' domain string http_only bool = true diff --git a/vlib/x/templating/dtm/dynamic_template_manager.v b/vlib/x/templating/dtm/dynamic_template_manager.v index 3b8adae7d8d25c..807f3eb83577d8 100644 --- a/vlib/x/templating/dtm/dynamic_template_manager.v +++ b/vlib/x/templating/dtm/dynamic_template_manager.v @@ -159,6 +159,7 @@ struct HtmlFileInfo { // TemplateCacheParams are used to specify cache expiration delay and provide placeholder data for substitution in templates. @[params] pub struct TemplateCacheParams { +pub: placeholders &map[string]DtmMultiTypeMap = &map[string]DtmMultiTypeMap{} cache_delay_expiration i64 = dtm.cache_delay_expiration_by_default } @@ -166,6 +167,7 @@ pub struct TemplateCacheParams { // DynamicTemplateManagerInitialisationParams is used with 'initialize' function. (See below at initialize section) @[params] pub struct DynamicTemplateManagerInitialisationParams { +pub: def_cache_path string compress_html bool = true active_cache_server bool = true diff --git a/vlib/x/vweb/context.v b/vlib/x/vweb/context.v index 6f0a9b38946995..c363570c90fc00 100644 --- a/vlib/x/vweb/context.v +++ b/vlib/x/vweb/context.v @@ -227,6 +227,7 @@ pub fn (mut ctx Context) server_error(msg string) Result { @[params] pub struct RedirectParams { +pub: typ RedirectType } diff --git a/vlib/x/vweb/middleware.v b/vlib/x/vweb/middleware.v index f89d6204290e2c..d792545702c3a7 100644 --- a/vlib/x/vweb/middleware.v +++ b/vlib/x/vweb/middleware.v @@ -30,6 +30,7 @@ mut: @[params] pub struct MiddlewareOptions[T] { +pub: handler fn (mut ctx T) bool @[required] after bool } diff --git a/vlib/x/vweb/vweb.v b/vlib/x/vweb/vweb.v index 355e6a4ad1693a..50dda7e6cf5f25 100644 --- a/vlib/x/vweb/vweb.v +++ b/vlib/x/vweb/vweb.v @@ -210,6 +210,7 @@ pub fn run[A, X](mut global_app A, port int) { @[params] pub struct RunParams { +pub: // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1 family net.AddrFamily = .ip6 host string