mirror of
https://github.com/vlang/v.git
synced 2025-09-13 01:16:02 -04:00
markused,checker: fix hello world size after the introduction of builtin.closure
in 2d87ac4 (#24989)
This commit is contained in:
parent
ace5df7236
commit
6aede65485
@ -2359,7 +2359,7 @@ fn (mut c Checker) stmt(mut node ast.Stmt) {
|
||||
}
|
||||
ast.Module {
|
||||
c.mod = node.name
|
||||
c.is_just_builtin_mod = node.name == 'builtin'
|
||||
c.is_just_builtin_mod = node.name in ['builtin', 'builtin.closure']
|
||||
c.is_builtin_mod = c.is_just_builtin_mod || node.name in ['os', 'strconv']
|
||||
c.check_valid_snake_case(node.name, 'module name', node.pos)
|
||||
}
|
||||
|
@ -171,10 +171,11 @@ fn (mut c Checker) markused_string_inter_lit(mut node ast.StringInterLiteral, ft
|
||||
}
|
||||
|
||||
fn (mut c Checker) markused_infixexpr(check bool) {
|
||||
if check {
|
||||
c.table.used_features.index = true
|
||||
c.table.used_features.arr_init = true
|
||||
if !check {
|
||||
return
|
||||
}
|
||||
c.table.used_features.index = true
|
||||
c.table.used_features.arr_init = true
|
||||
}
|
||||
|
||||
fn (mut c Checker) markused_array_method(check bool, method_name string) {
|
||||
|
@ -166,7 +166,18 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
|
||||
if !table.used_features.arr_init {
|
||||
table.used_features.arr_init = table.used_features.print_types.keys().any(table.type_to_str(it).contains('[]'))
|
||||
}
|
||||
if table.used_features.arr_init || table.used_features.comptime_for {
|
||||
if table.used_features.arr_init {
|
||||
core_fns << '__new_array'
|
||||
core_fns << 'new_array_from_c_array'
|
||||
core_fns << 'new_array_from_c_array_noscan'
|
||||
core_fns << '__new_array_with_default'
|
||||
core_fns << '__new_array_with_default_noscan'
|
||||
core_fns << '__new_array_with_multi_default'
|
||||
core_fns << '__new_array_with_multi_default_noscan'
|
||||
core_fns << '__new_array_with_array_default'
|
||||
core_fns << ref_array_idx_str + '.set'
|
||||
}
|
||||
if table.used_features.comptime_for {
|
||||
include_panic_deps = true
|
||||
core_fns << '__new_array'
|
||||
core_fns << 'new_array_from_c_array'
|
||||
|
@ -748,7 +748,7 @@ pub fn (mut w Walker) fn_decl(mut node ast.FnDecl) {
|
||||
w.mark_fn_ret_and_params(node.return_type, node.params)
|
||||
w.mark_fn_as_used(fkey)
|
||||
last_is_builtin_mod := w.is_builtin_mod
|
||||
w.is_builtin_mod = node.mod in ['builtin', 'os', 'strconv']
|
||||
w.is_builtin_mod = node.mod in ['builtin', 'os', 'strconv', 'builtin.closure']
|
||||
w.stmts(node.stmts)
|
||||
w.is_builtin_mod = last_is_builtin_mod
|
||||
w.defer_stmts(node.defer_stmts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user