mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +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() {
|
if arg.expr.is_pure_literal() {
|
||||||
str = "\$${cc.method_name}('${cc.args_var}', ${arg})"
|
str = "\$${cc.method_name}('${cc.args_var}', ${arg})"
|
||||||
}
|
}
|
||||||
|
} else if cc.kind == .pkgconfig {
|
||||||
|
str = "\$${cc.method_name}('${cc.args_var}')"
|
||||||
}
|
}
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
|
@ -1662,13 +1662,19 @@ fn (mut c Checker) comptime_if_cond(mut cond ast.Expr, mut sb strings.Builder) (
|
||||||
}
|
}
|
||||||
ast.ComptimeCall {
|
ast.ComptimeCall {
|
||||||
if cond.kind == .pkgconfig {
|
if cond.kind == .pkgconfig {
|
||||||
mut m := pkgconfig.main([cond.args_var]) or {
|
if mut m := pkgconfig.main([cond.args_var]) {
|
||||||
c.error(err.msg(), cond.pos)
|
if _ := m.run() {
|
||||||
return false, true
|
is_true = true
|
||||||
|
} else {
|
||||||
|
// pkgconfig not found, do not issue error, just set false
|
||||||
|
is_true = false
|
||||||
}
|
}
|
||||||
m.run() or { return false, true }
|
} else {
|
||||||
sb.write_string('true')
|
c.error(err.msg(), cond.pos)
|
||||||
return true, true
|
is_true = false
|
||||||
|
}
|
||||||
|
sb.write_string('${is_true}')
|
||||||
|
return is_true, true
|
||||||
}
|
}
|
||||||
if cond.kind == .d {
|
if cond.kind == .d {
|
||||||
t := c.expr(mut cond)
|
t := c.expr(mut cond)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue