parser: skip $if windows etc blocks on a different os
parent
3b929cdd03
commit
861f2d4bc0
|
@ -85,7 +85,7 @@ pub fn (_rune string) utf32_code() int {
|
||||||
for i := 1; i < _rune.len; i++ {
|
for i := 1; i < _rune.len; i++ {
|
||||||
c := int(_rune[i])
|
c := int(_rune[i])
|
||||||
res = res << shift
|
res = res << shift
|
||||||
res |= c & 63 /* 0x3f */
|
res |= c & 63 // 0x3f
|
||||||
shift = 6
|
shift = 6
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -31,12 +31,15 @@ fn (p mut Parser) comp_time() {
|
||||||
}
|
}
|
||||||
p.check(.lcbr)
|
p.check(.lcbr)
|
||||||
os := os_from_string(name)
|
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
|
// `$if os {` for a different target, skip everything inside
|
||||||
// to avoid compilation errors (like including <windows.h>
|
// to avoid compilation errors (like including <windows.h>
|
||||||
// on non-Windows systems)
|
// on non-Windows systems)
|
||||||
mut stack := 1
|
mut stack := 1
|
||||||
for {
|
for {
|
||||||
|
if p.tok == .key_return {
|
||||||
|
p.returns = true
|
||||||
|
}
|
||||||
if p.tok == .lcbr {
|
if p.tok == .lcbr {
|
||||||
stack++
|
stack++
|
||||||
} else if p.tok == .rcbr {
|
} else if p.tok == .rcbr {
|
||||||
|
|
Loading…
Reference in New Issue