@@ -20,20 +20,21 @@ const int_min = int(0x80000000)
20
20
const int_max = int (0x7FFFFFFF )
21
21
22
22
const (
23
- valid_comptime_if_os = ['windows' , 'ios' , 'macos' , 'mach' , 'darwin' , 'hpux' , 'gnu' ,
23
+ valid_comptime_if_os = ['windows' , 'ios' , 'macos' , 'mach' , 'darwin' , 'hpux' , 'gnu' ,
24
24
'qnx' , 'linux' , 'freebsd' , 'openbsd' , 'netbsd' , 'bsd' , 'dragonfly' , 'android' , 'solaris' ,
25
25
'haiku' , 'serenity' , 'vinix' ]
26
- valid_comptime_if_compilers = ['gcc' , 'tinyc' , 'clang' , 'mingw' , 'msvc' , 'cplusplus' ]
27
- valid_comptime_if_platforms = ['amd64' , 'i386' , 'aarch64' , 'arm64' , 'arm32' , 'rv64' , 'rv32' ]
28
- valid_comptime_if_cpu_features = ['x64' , 'x32' , 'little_endian' , 'big_endian' ]
29
- valid_comptime_if_other = ['js' , 'debug' , 'prod' , 'test' , 'glibc' , 'prealloc' ,
26
+ valid_comptime_compression_types = ['none' , 'zlib' ]
27
+ valid_comptime_if_compilers = ['gcc' , 'tinyc' , 'clang' , 'mingw' , 'msvc' , 'cplusplus' ]
28
+ valid_comptime_if_platforms = ['amd64' , 'i386' , 'aarch64' , 'arm64' , 'arm32' , 'rv64' , 'rv32' ]
29
+ valid_comptime_if_cpu_features = ['x64' , 'x32' , 'little_endian' , 'big_endian' ]
30
+ valid_comptime_if_other = ['js' , 'debug' , 'prod' , 'test' , 'glibc' , 'prealloc' ,
30
31
'no_bounds_checking' , 'freestanding' , 'threads' , 'js_node' , 'js_browser' , 'js_freestanding' ]
31
- valid_comptime_not_user_defined = all_valid_comptime_idents ()
32
- array_builtin_methods = ['filter' , 'clone' , 'repeat' , 'reverse' , 'map' , 'slice' ,
32
+ valid_comptime_not_user_defined = all_valid_comptime_idents ()
33
+ array_builtin_methods = ['filter' , 'clone' , 'repeat' , 'reverse' , 'map' , 'slice' ,
33
34
'sort' , 'contains' , 'index' , 'wait' , 'any' , 'all' , 'first' , 'last' , 'pop' ]
34
- reserved_type_names = ['bool' , 'char' , 'i8' , 'i16' , 'int' , 'i64' , 'byte' , 'u16' ,
35
+ reserved_type_names = ['bool' , 'char' , 'i8' , 'i16' , 'int' , 'i64' , 'byte' , 'u16' ,
35
36
'u32' , 'u64' , 'f32' , 'f64' , 'map' , 'string' , 'rune' ]
36
- vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead'
37
+ vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead'
37
38
)
38
39
39
40
fn all_valid_comptime_idents () []string {
@@ -5866,7 +5867,12 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type {
5866
5867
return ast.string_type
5867
5868
}
5868
5869
if node.is_embed {
5869
- c.file.embedded_files << node.embed_file
5870
+ // c.file.embedded_files << node.embed_file
5871
+ if node.embed_file.compression_type ! in checker.valid_comptime_compression_types {
5872
+ supported := checker.valid_comptime_compression_types.map ('.$it ' ).join (', ' )
5873
+ c.error ('not supported compression type: .${node.embed_file.compression_type} . supported: $supported ' ,
5874
+ node.pos)
5875
+ }
5870
5876
return c.table.find_type_idx ('v.embed_file.EmbedFileData' )
5871
5877
}
5872
5878
if node.is_vweb {
0 commit comments