mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: skip $if windows etc blocks on a different os
This commit is contained in:
parent
3b929cdd03
commit
861f2d4bc0
@ -85,7 +85,7 @@ pub fn (_rune string) utf32_code() int {
|
||||
for i := 1; i < _rune.len; i++ {
|
||||
c := int(_rune[i])
|
||||
res = res << shift
|
||||
res |= c & 63 /* 0x3f */
|
||||
res |= c & 63 // 0x3f
|
||||
shift = 6
|
||||
}
|
||||
return res
|
||||
|
@ -31,12 +31,15 @@ fn (p mut Parser) comp_time() {
|
||||
}
|
||||
p.check(.lcbr)
|
||||
os := os_from_string(name)
|
||||
if false && p.fileis('runtime.v') && os != p.os {
|
||||
if (!not && os != p.os) || (not && os == p.os) {
|
||||
// `$if os {` for a different target, skip everything inside
|
||||
// to avoid compilation errors (like including <windows.h>
|
||||
// on non-Windows systems)
|
||||
mut stack := 1
|
||||
for {
|
||||
if p.tok == .key_return {
|
||||
p.returns = true
|
||||
}
|
||||
if p.tok == .lcbr {
|
||||
stack++
|
||||
} else if p.tok == .rcbr {
|
||||
|
Loading…
Reference in New Issue
Block a user