vfmt: make ${} more robust; require it for every interpolation that uses '...' or "..."
parent
4ecc5001b9
commit
f1549b3ee7
|
@ -190,7 +190,7 @@ fn (mut context Context) kill_pgroup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut context Context) compilation_runner_loop() {
|
fn (mut context Context) compilation_runner_loop() {
|
||||||
cmd := '"$context.vexe" ${context.opts.join(' ')}'
|
cmd := '"${context.vexe}" ${context.opts.join(' ')}'
|
||||||
_ := <-context.rerun_channel
|
_ := <-context.rerun_channel
|
||||||
for {
|
for {
|
||||||
context.elog('>> loop: v_cycles: $context.v_cycles')
|
context.elog('>> loop: v_cycles: $context.v_cycles')
|
||||||
|
|
|
@ -200,7 +200,7 @@ pub fn (b &Benchmark) total_message(msg string) string {
|
||||||
if b.nskip > 0 {
|
if b.nskip > 0 {
|
||||||
tmsg += term.colorize(term.bold, term.colorize(term.yellow, '$b.nskip skipped')) + ', '
|
tmsg += term.colorize(term.bold, term.colorize(term.yellow, '$b.nskip skipped')) + ', '
|
||||||
}
|
}
|
||||||
tmsg += '$b.ntotal total. ${term.colorize(term.bold, 'Runtime:')} ${b.bench_timer.elapsed().microseconds() / 1000} ms.\n'
|
tmsg += '${b.ntotal} total. ${term.colorize(term.bold, 'Runtime:')} ${b.bench_timer.elapsed().microseconds() / 1000} ms.\n'
|
||||||
return tmsg
|
return tmsg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,13 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
|
||||||
|| (lit.fills[i] && lit.fwidths[i] >= 0) || lit.fwidths[i] != 0
|
|| (lit.fills[i] && lit.fwidths[i] >= 0) || lit.fwidths[i] != 0
|
||||||
|| lit.precisions[i] != 987698
|
|| lit.precisions[i] != 987698
|
||||||
mut needs_braces := needs_fspec
|
mut needs_braces := needs_fspec
|
||||||
|
for x in lit.exprs {
|
||||||
|
sx := x.str()
|
||||||
|
if sx.contains(r'"') || sx.contains(r"'") {
|
||||||
|
needs_braces = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if !needs_braces {
|
if !needs_braces {
|
||||||
if i + 1 < lit.vals.len && lit.vals[i + 1].len > 0 {
|
if i + 1 < lit.vals.len && lit.vals[i + 1].len > 0 {
|
||||||
next_char := lit.vals[i + 1][0]
|
next_char := lit.vals[i + 1][0]
|
||||||
|
@ -477,7 +484,7 @@ pub fn (node Stmt) str() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_to_string(f ConstField) string {
|
fn field_to_string(f ConstField) string {
|
||||||
return '${f.name.trim_prefix(f.mod + '.')} = $f.expr'
|
return '${f.name.trim_prefix(f.mod + '.')} = ${f.expr}'
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (e CompForKind) str() string {
|
pub fn (e CompForKind) str() string {
|
||||||
|
|
|
@ -901,7 +901,7 @@ fn (mut g Gen) table_gen(node ast.SqlStmt, typ SqlType) string {
|
||||||
for f in v {
|
for f in v {
|
||||||
tmp << '`$f`'
|
tmp << '`$f`'
|
||||||
}
|
}
|
||||||
fields << '/* $k */UNIQUE(${tmp.join(', ')})'
|
fields << '/* ${k} */UNIQUE(${tmp.join(', ')})'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if typ == .mysql {
|
if typ == .mysql {
|
||||||
|
|
Loading…
Reference in New Issue