v: deprecate `[if ident]` in favour of `[if ident ?]`
parent
d65aa977b8
commit
79df7f51c3
|
@ -35,7 +35,7 @@ fn (_ None__) str() string {
|
|||
return 'none'
|
||||
}
|
||||
|
||||
[if trace_error]
|
||||
[if trace_error ?]
|
||||
fn trace_error(x string) {
|
||||
eprintln('> ${@FN} | $x')
|
||||
}
|
||||
|
|
|
@ -340,10 +340,9 @@ pub fn (x Expr) str() string {
|
|||
return '($x.expr)'
|
||||
}
|
||||
PostfixExpr {
|
||||
// TODO: uncomment after [if x] is deprecated
|
||||
// if x.op == .question {
|
||||
// return '$x.expr ?'
|
||||
//}
|
||||
if x.op == .question {
|
||||
return '$x.expr ?'
|
||||
}
|
||||
return '$x.expr$x.op'
|
||||
}
|
||||
PrefixExpr {
|
||||
|
|
|
@ -7259,8 +7259,8 @@ fn (mut c Checker) evaluate_once_comptime_if_attribute(mut a ast.Attr) bool {
|
|||
return a.ct_skip
|
||||
} else {
|
||||
if a.ct_expr.name !in checker.valid_comp_not_user_defined {
|
||||
// TODO: uncomment after [if x] is deprecated in favour of [if x?], see also vlib/v/ast/str.v:343
|
||||
// c.note('`[if $a.ct_expr.name]` is deprecated. Use `[if $a.ct_expr.name ?]` instead', a.pos)
|
||||
c.note('`[if $a.ct_expr.name]` is deprecated. Use `[if $a.ct_expr.name ?]` instead',
|
||||
a.pos)
|
||||
a.ct_skip = a.ct_expr.name !in c.pref.compile_defines
|
||||
a.ct_evaled = true
|
||||
return a.ct_skip
|
||||
|
|
|
@ -2836,7 +2836,7 @@ fn (mut g Gen) autofree_scope_vars_stop(pos int, line_nr int, free_parent_scopes
|
|||
stop_pos)
|
||||
}
|
||||
|
||||
[if trace_autofree]
|
||||
[if trace_autofree ?]
|
||||
fn (mut g Gen) trace_autofree(line string) {
|
||||
g.writeln(line)
|
||||
}
|
||||
|
|
|
@ -1553,9 +1553,7 @@ fn (mut p Parser) parse_attr() ast.Attr {
|
|||
p.inside_if_expr = false
|
||||
p.inside_ct_if_expr = false
|
||||
if comptime_cond is ast.PostfixExpr {
|
||||
x := comptime_cond as ast.PostfixExpr
|
||||
comptime_cond_opt = true
|
||||
comptime_cond = x.expr
|
||||
}
|
||||
name = comptime_cond.str()
|
||||
} else if p.tok.kind == .string {
|
||||
|
|
|
@ -3,7 +3,7 @@ module util
|
|||
import os
|
||||
import v.pref
|
||||
|
||||
[if trace_mod_path_to_full_name]
|
||||
[if trace_mod_path_to_full_name ?]
|
||||
fn trace_mod_path_to_full_name(line string, mod string, file_path string, res string) {
|
||||
eprintln('> $line ${@FN} mod: ${mod:-20} | file_path: ${file_path:-30} | result: $res')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue