checker: add support for apk comptime if (#13079)
parent
6e6d51a1c9
commit
7276705684
|
@ -24,7 +24,7 @@ const (
|
|||
valid_comptime_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus']
|
||||
valid_comptime_if_platforms = ['amd64', 'i386', 'aarch64', 'arm64', 'arm32', 'rv64', 'rv32']
|
||||
valid_comptime_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian']
|
||||
valid_comptime_if_other = ['js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
|
||||
valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
|
||||
'no_bounds_checking', 'freestanding', 'threads', 'js_node', 'js_browser', 'js_freestanding',
|
||||
'interpreter', 'es5']
|
||||
valid_comptime_not_user_defined = all_valid_comptime_idents()
|
||||
|
|
|
@ -528,6 +528,7 @@ fn (mut c Checker) comptime_if_branch(cond ast.Expr, pos token.Position) bool {
|
|||
return false
|
||||
} else if cname in valid_comptime_if_other {
|
||||
match cname {
|
||||
'apk' { return !c.pref.is_apk }
|
||||
'js' { return !c.pref.backend.is_js() }
|
||||
'debug' { return !c.pref.is_debug }
|
||||
'prod' { return !c.pref.is_prod }
|
||||
|
|
Loading…
Reference in New Issue