diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v index 9569866790..c6e5bf353c 100644 --- a/cmd/tools/vtest-parser.v +++ b/cmd/tools/vtest-parser.v @@ -37,7 +37,7 @@ mut: // parser context in the worker processes: table table.Table scope ast.Scope - pref pref.Preferences + pref &pref.Preferences period_ms int // print periodic progress stop_print bool // stop printing the periodic progress } @@ -96,7 +96,9 @@ fn main() { } fn process_cli_args() &Context { - mut context := &Context{} + mut context := &Context{ + pref: 0 + } context.myself = os.executable() mut fp := flag.new_flag_parser(os.args_after('test-parser')) fp.application(os.file_name(context.myself)) diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index 6ab9546d6c..c137bdcf7e 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -113,6 +113,7 @@ pub fn new(input_path string) Doc { time_generated: time.now() } d.fmt = fmt.Fmt{ + pref: 0 indent: 0 is_debug: false table: d.table diff --git a/vlib/v/fmt/fmt_keep_test.v b/vlib/v/fmt/fmt_keep_test.v index c8d1ad3e69..3b130ccc73 100644 --- a/vlib/v/fmt/fmt_keep_test.v +++ b/vlib/v/fmt/fmt_keep_test.v @@ -13,6 +13,9 @@ const ( error_missing_vexe = 1 error_failed_tests = 2 b2v_keep_path = os.join_path('vlib', 'v', 'fmt', 'tests', 'bin2v_keep.vv') + fpref = &pref.Preferences{ + is_fmt: true + } ) fn test_fmt() { @@ -49,13 +52,10 @@ fn test_fmt() { continue } table := table.new_table() - file_ast := parser.parse_file(ipath, table, .parse_comments, &pref.Preferences{ - is_fmt: true - ccompiler: 'gcc' - }, &ast.Scope{ + file_ast := parser.parse_file(ipath, table, .parse_comments, fpref, &ast.Scope{ parent: 0 }) - result_ocontent := fmt.fmt(file_ast, table, false) + result_ocontent := fmt.fmt(file_ast, table, fpref, false) if expected_ocontent != result_ocontent { fmt_bench.fail() eprintln(fmt_bench.step_message_fail('file $vrelpath after formatting, does not look as expected.')) diff --git a/vlib/v/fmt/fmt_test.v b/vlib/v/fmt/fmt_test.v index 1bd7e66274..a4a620c4e2 100644 --- a/vlib/v/fmt/fmt_test.v +++ b/vlib/v/fmt/fmt_test.v @@ -11,6 +11,9 @@ import v.util const ( error_missing_vexe = 1 error_failed_tests = 2 + fpref = &pref.Preferences{ + is_fmt: true + } ) fn test_fmt() { @@ -44,12 +47,10 @@ fn test_fmt() { continue } table := table.new_table() - file_ast := parser.parse_file(ipath, table, .parse_comments, &pref.Preferences{ - is_fmt: true - }, &ast.Scope{ + file_ast := parser.parse_file(ipath, table, .parse_comments, fpref, &ast.Scope{ parent: 0 }) - result_ocontent := fmt.fmt(file_ast, table, false) + result_ocontent := fmt.fmt(file_ast, table, fpref, false) if expected_ocontent != result_ocontent { fmt_bench.fail() eprintln(fmt_bench.step_message_fail('file $ipath after formatting, does not look as expected.')) diff --git a/vlib/v/fmt/fmt_vlib_test.v b/vlib/v/fmt/fmt_vlib_test.v index 257bf6f054..8e004db10c 100644 --- a/vlib/v/fmt/fmt_vlib_test.v +++ b/vlib/v/fmt/fmt_vlib_test.v @@ -11,6 +11,9 @@ import v.util const ( error_missing_vexe = 1 error_failed_tests = 2 + fpref = &pref.Preferences{ + is_fmt: true + } ) fn test_vlib_fmt() { @@ -42,12 +45,10 @@ fn test_vlib_fmt() { continue } table := table.new_table() - file_ast := parser.parse_file(ipath, table, .parse_comments, &pref.Preferences{ - is_fmt: true - }, &ast.Scope{ + file_ast := parser.parse_file(ipath, table, .parse_comments, fpref, &ast.Scope{ parent: 0 }) - result_ocontent := fmt.fmt(file_ast, table, false) + result_ocontent := fmt.fmt(file_ast, table, fpref, false) if expected_ocontent != result_ocontent { fmt_bench.fail() eprintln(fmt_bench.step_message_fail('file $ipath after formatting, does not look as expected.'))