builtin: cleanup obsolete function in string.v and array.v (#19451)

This commit is contained in:
yuyi 2023-09-28 00:49:33 +08:00 committed by GitHub
parent 981f76cd04
commit ec30256c7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 15 deletions

View file

@ -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})')
@ -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.