mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
fix pkgconfig
This commit is contained in:
parent
893bae8423
commit
ed948d63c0
2 changed files with 13 additions and 5 deletions
|
@ -2130,6 +2130,8 @@ pub fn (cc ComptimeCall) expr_str() string {
|
|||
if arg.expr.is_pure_literal() {
|
||||
str = "\$${cc.method_name}('${cc.args_var}', ${arg})"
|
||||
}
|
||||
} else if cc.kind == .pkgconfig {
|
||||
str = "\$${cc.method_name}('${cc.args_var}')"
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
|
|
@ -1662,13 +1662,19 @@ fn (mut c Checker) comptime_if_cond(mut cond ast.Expr, mut sb strings.Builder) (
|
|||
}
|
||||
ast.ComptimeCall {
|
||||
if cond.kind == .pkgconfig {
|
||||
mut m := pkgconfig.main([cond.args_var]) or {
|
||||
if mut m := pkgconfig.main([cond.args_var]) {
|
||||
if _ := m.run() {
|
||||
is_true = true
|
||||
} else {
|
||||
// pkgconfig not found, do not issue error, just set false
|
||||
is_true = false
|
||||
}
|
||||
} else {
|
||||
c.error(err.msg(), cond.pos)
|
||||
return false, true
|
||||
is_true = false
|
||||
}
|
||||
m.run() or { return false, true }
|
||||
sb.write_string('true')
|
||||
return true, true
|
||||
sb.write_string('${is_true}')
|
||||
return is_true, true
|
||||
}
|
||||
if cond.kind == .d {
|
||||
t := c.expr(mut cond)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue