Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markused: fix codegen for empty import json file #23155

Merged
merged 3 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions vlib/v/markused/markused.v
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
core_fns << 'v.trace_calls.current_time'
core_fns << 'v.trace_calls.on_call'
}
if 'C.cJSON_Parse' in all_fns {
all_fn_root_names << 'tos5'
all_fn_root_names << 'time.unix' // used by json
table.used_features.used_maps++ // json needs new_map etc
include_panic_deps = true
}
all_fn_root_names << core_fns
if include_panic_deps {
all_fn_root_names << [
Expand Down Expand Up @@ -424,12 +430,6 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
}
}

if 'C.cJSON_Parse' in all_fns {
all_fn_root_names << 'tos5'
all_fn_root_names << 'time.unix' // used by json
table.used_features.used_maps++ // json needs new_map etc
}

mut walker := Walker.new(
table: table
files: ast_files
Expand Down
Empty file.
Empty file.
1 change: 1 addition & 0 deletions vlib/v/tests/skip_unused/import_json_only.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import json as _
Loading