mirror of
https://github.com/vlang/v.git
synced 2025-09-09 15:27:05 -04:00
parent
25f14d3bbb
commit
da5bb68b61
@ -759,7 +759,7 @@ fn (mut c Checker) call_expr(mut node ast.CallExpr) ast.Type {
|
||||
c.markused_option_or_result(!c.is_builtin_mod && c.mod != 'strings')
|
||||
}
|
||||
c.expected_or_type = old_expected_or_type
|
||||
c.markused_call_expr(mut node)
|
||||
c.markused_call_expr(left_type, mut node)
|
||||
if !c.inside_const && c.table.cur_fn != unsafe { nil } && !c.table.cur_fn.is_main
|
||||
&& !c.table.cur_fn.is_test {
|
||||
// TODO: use just `if node.or_block.kind == .propagate_result && !c.table.cur_fn.return_type.has_flag(.result) {` after the deprecation for ?!Type
|
||||
|
@ -111,7 +111,7 @@ fn (mut c Checker) markused_comptimefor(mut node ast.ComptimeFor, unwrapped_expr
|
||||
}
|
||||
}
|
||||
|
||||
fn (mut c Checker) markused_call_expr(mut node ast.CallExpr) {
|
||||
fn (mut c Checker) markused_call_expr(left_type ast.Type, mut node ast.CallExpr) {
|
||||
if !c.is_builtin_mod && c.mod == 'main' && !c.table.used_features.external_types {
|
||||
if node.is_method {
|
||||
if c.table.sym(node.left_type).is_builtin() {
|
||||
@ -121,6 +121,10 @@ fn (mut c Checker) markused_call_expr(mut node ast.CallExpr) {
|
||||
c.table.used_features.external_types = true
|
||||
}
|
||||
}
|
||||
if left_type != 0 && left_type.is_ptr() && !c.table.used_features.auto_str_ptr
|
||||
&& node.name == 'str' {
|
||||
c.table.used_features.auto_str_ptr = true
|
||||
}
|
||||
}
|
||||
|
||||
fn (mut c Checker) markused_fn_call(mut node ast.CallExpr) {
|
||||
|
1
vlib/v/tests/skip_unused/option_ptr_print.run.out
Normal file
1
vlib/v/tests/skip_unused/option_ptr_print.run.out
Normal file
@ -0,0 +1 @@
|
||||
[vlib/v/tests/skip_unused/option_ptr_print.vv:7] hrefs.str(): &<div class="Truncate" >abc</div>
|
@ -0,0 +1 @@
|
||||
[vlib/v/tests/skip_unused/option_ptr_print.vv:7] hrefs.str(): &<div class="Truncate" >abc</div>
|
8
vlib/v/tests/skip_unused/option_ptr_print.vv
Normal file
8
vlib/v/tests/skip_unused/option_ptr_print.vv
Normal file
@ -0,0 +1,8 @@
|
||||
import net.html
|
||||
|
||||
fn main() {
|
||||
mut doc := html.parse('<body><div class="Box-footer"><div class="Truncate">abc</div></div></body>')
|
||||
footer := doc.get_tags_by_class_name('Box-footer')[0]
|
||||
hrefs := footer.get_tag_by_class_name('Truncate')
|
||||
dump(hrefs?.str())
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user