Skip to content

Commit 2332ecf

Browse files
authored
v: refactor $var to ${var} across entire repository, make vfmt always output the newer form ${expr} (#26494)
1 parent 2b86243 commit 2332ecf

214 files changed

Lines changed: 634 additions & 683 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/android_cross_compile.vsh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ fn main() {
2424
include_path := os.join_path(sysroot_path, 'usr', 'include')
2525
android_include_path := os.join_path(include_path, 'android')
2626

27-
//'-I"$include_path"'
28-
cflags := ['-I"$android_include_path"', '-Wno-unused-value', '-Wno-implicit-function-declaration',
27+
//'-I"${include_path}"'
28+
cflags := ['-I"${android_include_path}"', '-Wno-unused-value', '-Wno-implicit-function-declaration',
2929
'-Wno-int-conversion']
3030
for arch in ndk.supported_archs {
3131
for level in ['min', 'max'] {
@@ -46,22 +46,22 @@ fn main() {
4646
o_file := os.join_path(work_dir, arch + '-' + level + '.o')
4747

4848
// x.v -> x.c
49-
v_compile_cmd := '$vexe -o $c_file -os android -gc none $v_example'
49+
v_compile_cmd := '${vexe} -o ${c_file} -os android -gc none ${v_example}'
5050
vres := os.execute(v_compile_cmd)
5151
if vres.exit_code != 0 {
52-
panic('"$v_compile_cmd" failed: $vres.output')
52+
panic('"${v_compile_cmd}" failed: ${vres.output}')
5353
}
5454
assert os.exists(c_file)
5555

5656
// x.c -> x.o
57-
compile_cmd := '$compiler_api ${cflags.join(' ')} -c $c_file -o $o_file'
57+
compile_cmd := '${compiler_api} ${cflags.join(' ')} -c ${c_file} -o ${o_file}'
5858
cres := os.execute(compile_cmd)
5959
if cres.exit_code != 0 {
60-
panic('"$compile_cmd" failed: $cres.output')
60+
panic('"${compile_cmd}" failed: ${cres.output}')
6161
}
6262
assert os.exists(o_file)
6363
compiler_exe_name := os.file_name(compiler_api)
64-
println('Compiled examples/toml.v successfully for ($level) $arch $compiler_exe_name')
64+
println('Compiled examples/toml.v successfully for (${level}) ${arch} ${compiler_exe_name}')
6565
}
6666
}
6767
}

cmd/tools/changelog_helper.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn (mut app App) process_line(text string) ! {
162162
category = .interpreter
163163
} else if is_examples(text) {
164164
category = .examples
165-
// println("Skipping line (example) $text")
165+
// println("Skipping line (example) ${text}")
166166
// return
167167
} else if is_skip(text) {
168168
// Always skip cleanups, typos etc

cmd/tools/fast/fast.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn main() {
123123
// measure
124124
diff1 := measure('${vdir}/vprod ${voptions} -o v.c cmd/v', 'v.c')
125125
diff2 := measure('${vdir}/vprod ${voptions} -cc ${ccompiler_path} -o v2 cmd/v', 'v2')
126-
diff3 := 0 // measure('$vdir/vprod -native $vdir/cmd/tools/1mil.v', 'native 1mil')
126+
diff3 := 0 // measure('${vdir}/vprod -native ${vdir}/cmd/tools/1mil.v', 'native 1mil')
127127
diff4 := measure('${vdir}/vprod ${voptions} -cc ${ccompiler_path} examples/hello_world.v',
128128
'hello.v')
129129
vc_size := os.file_size('v.c') / 1000

cmd/tools/git_pre_commit_hook.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() {
5858
eprintln('The V pre commit hook will format ${vfiles.len} V file(s):')
5959
// vfmt off
6060
for vfile in vfiles {
61-
eprintln(' ${term.bold('$vfile')}')
61+
eprintln(' ${term.bold('${vfile}')}')
6262
}
6363
// vfmt on
6464
all_vfiles_on_a_line := vfiles.map(os.quoted_path(it)).join(' ')

cmd/tools/modules/scripting/scripting.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ pub fn used_tools_must_exist(tools []string) {
195195
pub fn show_sizes_of_files(files []string) {
196196
for f in files {
197197
size := os.file_size(f)
198-
println('${size} ${f}') // println('${size:10d} $f')
198+
println('${size} ${f}') // println('${size:10d} ${f}')
199199
}
200200
}

cmd/tools/modules/testing/common.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
616616
for cretry in 0 .. max_compilation_retries {
617617
compile_r = ts.execute(cmd, mtc)
618618
compile_cmd_duration = compile_d_cmd.elapsed()
619-
// eprintln('>>>> cretry: $cretry | compile_r.exit_code: $compile_r.exit_code | compile_cmd_duration: ${compile_cmd_duration:8} | file: $normalised_relative_file')
619+
// eprintln('>>>> cretry: ${cretry} | compile_r.exit_code: ${compile_r.exit_code} | compile_cmd_duration: ${compile_cmd_duration:8} | file: ${normalised_relative_file}')
620620
if compile_r.exit_code == 0 {
621621
break
622622
}

cmd/tools/modules/testing/output_normal.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn (r &NormalReporter) session_stop(message string, mut ts TestSession) {
134134
// the most general form; it may be useful for other reporters
135135
// in the normal one, it currently does nothing
136136
pub fn (mut r NormalReporter) report(index int, message LogMessage) {
137-
// eprintln('> ${@METHOD} index: $index | message: $message')
137+
// eprintln('> ${@METHOD} index: ${index} | message: ${message}')
138138
if message.kind == .compile_begin {
139139
lock r.compiling {
140140
r.compiling[message.file] = message

cmd/tools/vbuild-tools.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn main() {
4242
for stool in tools_in_subfolders {
4343
session.add(os.join_path(tfolder, stool))
4444
}
45-
// eprintln('> session.files: $session.files')
46-
// eprintln('> session.skip_files: $session.skip_files')
45+
// eprintln('> session.files: ${session.files}')
46+
// eprintln('> session.skip_files: ${session.skip_files}')
4747
session.test()
4848
eprintln(session.benchmark.total_message(finish_label))
4949
if session.failed_cmds.len > 0 {

cmd/tools/vcheck-md.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn (mut f MDFile) echeck(actual int, limit int, ctx CheckResultContext, msg_temp
213213
fn (mut f MDFile) check() CheckResult {
214214
mut anchor_data := AnchorData{}
215215
for j, line in f.lines {
216-
// f.progress('line: $j')
216+
// f.progress('line: ${j}')
217217
if !f.skip_line_length_check {
218218
ctx := CheckResultContext{f.path, j, line}
219219
if f.state == .vexample {
@@ -466,7 +466,7 @@ fn (mut f MDFile) check_examples() {
466466
vfile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.v')
467467
efile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.exe')
468468
mut should_cleanup_vfile := true
469-
// eprintln('>>> checking example $vfile ...')
469+
// eprintln('>>> checking example ${vfile} ...')
470470
vcontent := e.text.join('\n') + '\n'
471471
os.write_file(vfile, vcontent) or { panic(err) }
472472
mut acommands := e.command.split(' ')

cmd/tools/vcomplete.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,6 @@ Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
798798

799799
fn main() {
800800
args := os.args[1..]
801-
// println('"$args"')
801+
// println('"${args}"')
802802
auto_complete(args)
803803
}

0 commit comments

Comments
 (0)