Skip to content

Commit

Permalink
builtin: cleanup obsolete function in string.v and array.v (#19451)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Sep 27, 2023
1 parent 981f76c commit ec30256
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
8 changes: 1 addition & 7 deletions vlib/builtin/array.v
Expand Up @@ -530,7 +530,7 @@ pub fn (mut a array) delete_last() {
// Alternative: Slices can also be made with [start..end] notation
// Alternative: `.slice_ni()` will always return an array.
fn (a array) slice(start int, _end int) array {
mut end := if _end == 2147483647 { a.len } else { _end } // max_int
end := if _end == 2147483647 { a.len } else { _end } // max_int
$if !no_bounds_checking {
if start > end {
panic('array.slice: invalid slice index (${start} > ${end})')
Expand Down Expand Up @@ -609,12 +609,6 @@ fn (a array) slice_ni(_start int, _end int) array {
return res
}

// used internally for [2..4]
fn (a array) slice2(start int, _end int, end_max bool) array {
end := if end_max { a.len } else { _end }
return a.slice(start, end)
}

// clone_static_to_depth() returns an independent copy of a given array.
// Unlike `clone_to_depth()` it has a value receiver and is used internally
// for slice-clone expressions like `a[2..4].clone()` and in -autofree generated code.
Expand Down
7 changes: 0 additions & 7 deletions vlib/builtin/string.v
Expand Up @@ -1027,13 +1027,6 @@ pub fn (s string) split_into_lines() []string {
return res
}

// used internally for [2..4]
[inline]
fn (s string) substr2(start int, _end int, end_max bool) string {
end := if end_max { s.len } else { _end }
return s.substr(start, end)
}

// substr returns the string between index positions `start` and `end`.
// Example: assert 'ABCD'.substr(1,3) == 'BC'
[direct_array_access]
Expand Down
1 change: 0 additions & 1 deletion vlib/v/markused/markused.v
Expand Up @@ -99,7 +99,6 @@ pub fn mark_used(mut table ast.Table, pref_ &pref.Preferences, ast_files []&ast.
'22.repeat_to_depth',
'22.slice',
'22.slice_ni',
'22.slice2',
'61.get',
'61.set',
'65558.last',
Expand Down

0 comments on commit ec30256

Please sign in to comment.