Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 17, 2025
1 parent cfda1f0 commit 3974a31
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion vlib/v/ast/table.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import v.util
@[heap; minify]
pub struct UsedFeatures {
pub mut:
interfaces bool // interface
dump bool // dump()
index bool // string[0]
range_index bool // string[0..1]
Expand Down
8 changes: 3 additions & 5 deletions vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -1392,8 +1392,7 @@ fn (mut c Checker) check_expr_option_or_result_call(expr ast.Expr, ret_type ast.
}

fn (mut c Checker) check_or_expr(node ast.OrExpr, ret_type ast.Type, expr_return_type ast.Type, expr ast.Expr) {
c.markused_option_or_result(c.pref.skip_unused && !c.is_builtin_mod && node.kind != .absent
&& c.mod != 'strings')
c.markused_option_or_result(!c.is_builtin_mod && node.kind != .absent && c.mod != 'strings')

if node.kind == .propagate_option {
if c.table.cur_fn != unsafe { nil } && !c.table.cur_fn.return_type.has_flag(.option)
Expand Down Expand Up @@ -1794,7 +1793,7 @@ fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type {
c.check_or_expr(node.or_block, unwrapped_typ, c.expected_or_type, node)
c.expected_or_type = ast.void_type
}
c.markused_option_or_result(c.pref.skip_unused && node.or_block.kind != .absent
c.markused_option_or_result(node.or_block.kind != .absent
&& !c.table.used_features.option_or_result)
return field.typ
}
Expand Down Expand Up @@ -3262,8 +3261,7 @@ pub fn (mut c Checker) expr(mut node ast.Expr) ast.Type {
ast.StructInit {
if node.unresolved {
mut expr_ := c.table.resolve_init(node, c.unwrap_generic(node.typ))
c.markused_used_maps(c.pref.skip_unused && c.table.used_features.used_maps == 0
&& expr_ is ast.MapInit)
c.markused_used_maps(c.table.used_features.used_maps == 0 && expr_ is ast.MapInit)
return c.expr(mut expr_)
}
mut inited_fields := []string{}
Expand Down
3 changes: 0 additions & 3 deletions vlib/v/checker/interface.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ fn (mut c Checker) interface_decl(mut node ast.InterfaceDecl) {
is_js := node.language == .js
if mut decl_sym.info is ast.Interface {
mut has_generic_types := false
if c.pref.skip_unused && decl_sym.mod == 'main' {
c.table.used_features.interfaces = true
}
if node.embeds.len > 0 {
all_embeds := c.expand_iface_embeds(node, 0, node.embeds)
// eprintln('> node.name: $node.name | node.embeds.len: $node.embeds.len | all_embeds: $all_embeds.len')
Expand Down

0 comments on commit 3974a31

Please sign in to comment.