mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
vlib: remove functions and fields, deprecated before 2023-03-20
* remove []int.reduce in favour of arrays.fold * remove datatypes.Set.equal in favour of datatypes.Set.== * remove datatypes.Set.difference in favour of datatypes.Set.- * remove gg.Context.set_cfg in favour of gg.Context.set_text_cfg * remove gg.Context.timage_pip in favour of gg.Context.pipeline.alpha * remove os.is_writable_folder in favour of os.ensure_folder_is_writable Discovered with `v run cmd/tools/show_ancient_deprecations.v 180`
This commit is contained in:
parent
255e72456b
commit
7ffa8c13bf
6 changed files with 4 additions and 47 deletions
|
@ -968,20 +968,6 @@ pub fn copy(mut dst []u8, src []u8) int {
|
|||
return min
|
||||
}
|
||||
|
||||
// reduce executes a given reducer function on each element of the array,
|
||||
// resulting in a single output value.
|
||||
// NOTE: It exists as a method on `[]int` types only.
|
||||
// See also `arrays.reduce` for same name or `arrays.fold` for same functionality.
|
||||
[deprecated: 'use arrays.fold instead, this function has less flexibility than arrays.fold']
|
||||
[deprecated_after: '2022-10-11']
|
||||
pub fn (a []int) reduce(iter fn (int, int) int, accum_start int) int {
|
||||
mut accum_ := accum_start
|
||||
for i in a {
|
||||
accum_ = iter(accum_, i)
|
||||
}
|
||||
return accum_
|
||||
}
|
||||
|
||||
// grow_cap grows the array's capacity by `amount` elements.
|
||||
// Internally, it does this by copying the entire array to
|
||||
// a new memory location (creating a clone).
|
||||
|
|
|
@ -46,12 +46,6 @@ pub fn (mut set Set[T]) clear() {
|
|||
set.elements = map[T]u8{}
|
||||
}
|
||||
|
||||
// equal checks whether the two given sets are equal (i.e. contain all and only the same elements).
|
||||
[deprecated: 'use set1[T] == set2[T] instead']
|
||||
pub fn (l Set[T]) equal(r Set[T]) bool {
|
||||
return l == r
|
||||
}
|
||||
|
||||
// == checks whether the two given sets are equal (i.e. contain all and only the same elements).
|
||||
pub fn (l Set[T]) == (r Set[T]) bool {
|
||||
if l.elements.len != r.elements.len {
|
||||
|
@ -114,12 +108,6 @@ pub fn (l Set[T]) intersection(r Set[T]) Set[T] {
|
|||
return set
|
||||
}
|
||||
|
||||
// difference returns the difference of sets.
|
||||
[deprecated: 'use set1[T] - set2[T] instead']
|
||||
pub fn (l Set[T]) difference(r Set[T]) Set[T] {
|
||||
return l - r
|
||||
}
|
||||
|
||||
// - returns the difference of sets.
|
||||
pub fn (l Set[T]) - (r Set[T]) Set[T] {
|
||||
mut set := l
|
||||
|
|
|
@ -168,7 +168,6 @@ pub mut:
|
|||
height int
|
||||
clear_pass gfx.PassAction
|
||||
window sapp.Desc
|
||||
timage_pip sgl.Pipeline [deprecated: 'Use `Context.pipeline.alpha` instead!']
|
||||
pipeline &PipelineContainer = unsafe { nil }
|
||||
config Config
|
||||
user_data voidptr
|
||||
|
@ -259,10 +258,6 @@ fn gg_init_sokol_window(user_data voidptr) {
|
|||
ctx.pipeline = &PipelineContainer{}
|
||||
ctx.pipeline.init_pipeline()
|
||||
|
||||
// Keep the old pipeline for now, cuz v ui used it.
|
||||
ctx.timage_pip = ctx.pipeline.alpha
|
||||
|
||||
//
|
||||
if ctx.config.init_fn != unsafe { nil } {
|
||||
$if android {
|
||||
// NOTE on Android sokol can emit resize events *before* the init function is
|
||||
|
|
|
@ -147,12 +147,6 @@ pub fn (ctx &Context) set_text_cfg(cfg gx.TextCfg) {
|
|||
ctx.ft.fons.vert_metrics(&ascender, &descender, &lh)
|
||||
}
|
||||
|
||||
// set_cfg sets the current text configuration
|
||||
[deprecated: 'use set_text_cfg() instead']
|
||||
pub fn (ctx &Context) set_cfg(cfg gx.TextCfg) {
|
||||
ctx.set_text_cfg(cfg)
|
||||
}
|
||||
|
||||
// draw_text draws the string in `text_` starting at top-left position `x`,`y`.
|
||||
// Text settings can be provided with `cfg`.
|
||||
pub fn (ctx &Context) draw_text(x int, y int, text_ string, cfg gx.TextCfg) {
|
||||
|
|
|
@ -920,9 +920,3 @@ pub fn config_dir() !string {
|
|||
}
|
||||
return error('Cannot find config directory')
|
||||
}
|
||||
|
||||
[deprecated: 'use os.ensure_folder_is_writable instead']
|
||||
pub fn is_writable_folder(folder string) !bool {
|
||||
ensure_folder_is_writable(folder)!
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -38,15 +38,15 @@ fn test_flag_result() {
|
|||
}
|
||||
|
||||
fn test_array_sym() {
|
||||
var := [1, 2]
|
||||
var := ['abc', 'def']
|
||||
typ := reflection.type_of(var)
|
||||
assert typ.sym.kind == .array
|
||||
assert typ.sym.language == .v
|
||||
assert typ.sym.methods.len > 0
|
||||
assert typ.sym.methods.filter(it.name == 'reduce').len > 0
|
||||
assert typ.sym.name == '[]int'
|
||||
assert typ.sym.methods.filter(it.name == 'join').len > 0
|
||||
assert typ.sym.name == '[]string'
|
||||
assert (typ.sym.info as reflection.Array).nr_dims == 1
|
||||
assert (typ.sym.info as reflection.Array).elem_type == typeof[int]().idx
|
||||
assert (typ.sym.info as reflection.Array).elem_type == typeof[string]().idx
|
||||
}
|
||||
|
||||
fn test_sumtype_sym() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue