mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
all: remove deprecations made before 2024-11-06
This commit is contained in:
parent
5944f3b0a0
commit
a1d94500e6
@ -21,9 +21,6 @@ pub mut:
|
||||
pre_execute FnCommandCallback = unsafe { nil }
|
||||
execute FnCommandCallback = unsafe { nil }
|
||||
post_execute FnCommandCallback = unsafe { nil }
|
||||
disable_help bool @[deprecated: 'use defaults.help instead'; deprecated_after: '2024-06-31']
|
||||
disable_man bool @[deprecated: 'use defaults.man instead'; deprecated_after: '2024-06-31']
|
||||
disable_version bool @[deprecated: 'use defaults.version instead'; deprecated_after: '2024-06-31']
|
||||
disable_flags bool
|
||||
sort_flags bool
|
||||
sort_commands bool
|
||||
@ -65,10 +62,7 @@ pub fn (cmd &Command) str() string {
|
||||
res << ' version: "${cmd.version}"'
|
||||
res << ' description: "${cmd.description}"'
|
||||
res << ' man_description: "${cmd.man_description}"'
|
||||
res << ' disable_help: ${cmd.disable_help}'
|
||||
res << ' disable_man: ${cmd.disable_man}'
|
||||
res << ' disable_flags: ${cmd.disable_flags}'
|
||||
res << ' disable_version: ${cmd.disable_version}'
|
||||
res << ' sort_flags: ${cmd.sort_flags}'
|
||||
res << ' sort_commands: ${cmd.sort_commands}'
|
||||
res << ' cb execute: ${cmd.execute}'
|
||||
@ -182,41 +176,24 @@ pub fn (mut cmd Command) add_flag(flag Flag) {
|
||||
fn (mut cmd Command) parse_defaults() {
|
||||
// Help
|
||||
if cmd.defaults.help is bool {
|
||||
// If `defaults.help` has the default value `true` and
|
||||
// `disable_help` is also set, fall back to `disable_help`.
|
||||
if cmd.defaults.help && cmd.disable_help {
|
||||
cmd.defaults.parsed.help.flag = false
|
||||
cmd.defaults.parsed.help.command = false
|
||||
} else {
|
||||
cmd.defaults.parsed.help.flag = cmd.defaults.help
|
||||
cmd.defaults.parsed.help.command = cmd.defaults.help
|
||||
}
|
||||
cmd.defaults.parsed.help.flag = cmd.defaults.help
|
||||
cmd.defaults.parsed.help.command = cmd.defaults.help
|
||||
} else if cmd.defaults.help is CommandFlag {
|
||||
cmd.defaults.parsed.help.flag = cmd.defaults.help.flag
|
||||
cmd.defaults.parsed.help.command = cmd.defaults.help.command
|
||||
}
|
||||
// Version
|
||||
if cmd.defaults.version is bool {
|
||||
if cmd.defaults.version && cmd.disable_version {
|
||||
cmd.defaults.parsed.version.flag = false
|
||||
cmd.defaults.parsed.version.command = false
|
||||
} else {
|
||||
cmd.defaults.parsed.version.flag = cmd.defaults.version
|
||||
cmd.defaults.parsed.version.command = cmd.defaults.version
|
||||
}
|
||||
cmd.defaults.parsed.version.flag = cmd.defaults.version
|
||||
cmd.defaults.parsed.version.command = cmd.defaults.version
|
||||
} else if cmd.defaults.version is CommandFlag {
|
||||
cmd.defaults.parsed.version.flag = cmd.defaults.version.flag
|
||||
cmd.defaults.parsed.version.command = cmd.defaults.version.command
|
||||
}
|
||||
// Man
|
||||
if cmd.defaults.man is bool {
|
||||
if cmd.defaults.man && cmd.disable_man {
|
||||
cmd.defaults.parsed.man.flag = false
|
||||
cmd.defaults.parsed.man.command = false
|
||||
} else {
|
||||
cmd.defaults.parsed.man.flag = cmd.defaults.man
|
||||
cmd.defaults.parsed.man.command = cmd.defaults.man
|
||||
}
|
||||
cmd.defaults.parsed.man.flag = cmd.defaults.man
|
||||
cmd.defaults.parsed.man.command = cmd.defaults.man
|
||||
} else if cmd.defaults.man is CommandFlag {
|
||||
cmd.defaults.parsed.man.flag = cmd.defaults.man.flag
|
||||
cmd.defaults.parsed.man.command = cmd.defaults.man.command
|
||||
|
@ -27,13 +27,6 @@ pub fn len(s string) int {
|
||||
return count
|
||||
}
|
||||
|
||||
// get_uchar convert a UTF-8 unicode codepoint in string[index] into a UTF-32 encoded int unicode char
|
||||
@[deprecated: 'use `.get_rune(s string, index int)` instead']
|
||||
@[deprecated_after: '2024-11-17']
|
||||
pub fn get_uchar(s string, index int) int {
|
||||
return int(get_rune(s, index))
|
||||
}
|
||||
|
||||
// get_rune convert a UTF-8 unicode codepoint in string[index] into a UTF-32 encoded rune
|
||||
pub fn get_rune(s string, index int) rune {
|
||||
mut res := 0
|
||||
@ -181,13 +174,6 @@ pub fn is_number(r rune) bool {
|
||||
return is_excluding_latin(number_table, r)
|
||||
}
|
||||
|
||||
// is_uchar_punct return true if the input unicode is a western unicode punctuation
|
||||
@[deprecated: 'use `.is_rune_punct(r rune)` instead']
|
||||
@[deprecated_after: '2024-11-17']
|
||||
pub fn is_uchar_punct(uchar int) bool {
|
||||
return is_rune_punct(rune(uchar))
|
||||
}
|
||||
|
||||
// is_rune_punct return true if the input unicode is a western unicode punctuation
|
||||
pub fn is_rune_punct(r rune) bool {
|
||||
return find_punct_in_table(r, unicode_punct_western) != rune(-1)
|
||||
@ -200,13 +186,6 @@ pub fn is_global_punct(s string, index int) bool {
|
||||
return is_rune_global_punct(get_rune(s, index))
|
||||
}
|
||||
|
||||
// is_uchar_global_punct return true if the input unicode is a global unicode punctuation
|
||||
@[deprecated: 'use `.is_rune_global_punct(r rune)` instead']
|
||||
@[deprecated_after: '2024-11-17']
|
||||
pub fn is_uchar_global_punct(uchar int) bool {
|
||||
return is_rune_global_punct(rune(uchar))
|
||||
}
|
||||
|
||||
// is_rune_global_punct return true if the input unicode is a global unicode punctuation
|
||||
pub fn is_rune_global_punct(r rune) bool {
|
||||
return find_punct_in_table(r, unicode_punct) != rune(-1)
|
||||
|
@ -14,7 +14,6 @@ pub mut:
|
||||
img_id int
|
||||
img_rect Rect // defines the size and position on image when rendering to the screen
|
||||
part_rect Rect // defines the size and position of part of the image to use when rendering
|
||||
rotate f32 @[deprecated: 'use `rotation` instead of `rotate`'; deprecated_after: '2024-07-30']
|
||||
z f32
|
||||
color gx.Color = gx.white
|
||||
effect ImageEffect = .alpha
|
||||
|
@ -490,55 +490,6 @@ pub fn (mut h Header) delete_custom(key string) {
|
||||
*/
|
||||
}
|
||||
|
||||
@[params]
|
||||
pub struct HeaderCoerceConfig {
|
||||
pub:
|
||||
canonicalize bool
|
||||
}
|
||||
|
||||
// coerce coerces data in the Header by joining keys that match
|
||||
// case-insensitively into one entry.
|
||||
//[deprecated: 'no need to call this method anymore, keys are automatically coerced']
|
||||
pub fn (mut h Header) coerce(flags HeaderCoerceConfig) {
|
||||
keys := h.keys()
|
||||
// for k in keys {
|
||||
// println('${k} => ${h.get_custom(k, exact: true) or { continue }}')
|
||||
//}
|
||||
new_keys := arrays.distinct(h.keys().map(it.to_lower()))
|
||||
if keys.len == new_keys.len {
|
||||
return
|
||||
}
|
||||
mut new_data := [max_headers]HeaderKV{}
|
||||
mut i := 0
|
||||
for _, key in new_keys {
|
||||
for _, old_key in keys {
|
||||
if old_key.to_lower() == key {
|
||||
new_data[i] = HeaderKV{key, h.get_custom(old_key, exact: true) or { continue }}
|
||||
i++
|
||||
}
|
||||
}
|
||||
/*
|
||||
master_key := if flags.canonicalize { canonicalize(kl) } else { data_keys[0] }
|
||||
|
||||
// save master data
|
||||
master_data := h.data[master_key]
|
||||
h.data.delete(master_key)
|
||||
|
||||
for key in data_keys {
|
||||
if key == master_key {
|
||||
h.data[master_key] << master_data
|
||||
continue
|
||||
}
|
||||
h.data[master_key] << h.data[key]
|
||||
h.data.delete(key)
|
||||
}
|
||||
h.keys[kl] = [master_key]
|
||||
*/
|
||||
}
|
||||
h.data = new_data
|
||||
h.cur_pos = i
|
||||
}
|
||||
|
||||
// contains returns whether the header key exists in the map.
|
||||
pub fn (h Header) contains(key CommonHeader) bool {
|
||||
if h.cur_pos == 0 {
|
||||
|
@ -154,30 +154,12 @@ fn test_custom_values() {
|
||||
assert h.custom_values('HELLO', exact: true) == []
|
||||
}
|
||||
|
||||
fn test_coerce() {
|
||||
mut h := new_header()
|
||||
h.add_custom('accept', 'foo')!
|
||||
h.add(.accept, 'bar')
|
||||
assert h.values(.accept) == ['foo', 'bar']
|
||||
assert h.keys().len == 2
|
||||
|
||||
h.coerce()
|
||||
assert h.values(.accept) == ['foo', 'bar']
|
||||
assert h.keys() == ['accept'] // takes the first occurrence
|
||||
}
|
||||
|
||||
fn test_coerce_canonicalize() {
|
||||
mut h := new_header()
|
||||
h.add_custom('accept', 'foo')!
|
||||
h.add(.accept, 'bar')
|
||||
assert h.values(.accept) == ['foo', 'bar']
|
||||
assert h.keys().len == 2
|
||||
|
||||
/*
|
||||
h.coerce(canonicalize: true)
|
||||
assert h.values(.accept) == ['foo', 'bar']
|
||||
assert h.keys() == ['Accept'] // canonicalize header
|
||||
*/
|
||||
}
|
||||
|
||||
fn test_coerce_custom() {
|
||||
@ -187,11 +169,6 @@ fn test_coerce_custom() {
|
||||
h.add_custom('HELLO', 'baz')!
|
||||
assert h.custom_values('hello') == ['foo', 'bar', 'baz']
|
||||
assert h.keys().len == 3
|
||||
|
||||
h.coerce()
|
||||
assert h.custom_values('hello') == ['foo', 'bar', 'baz']
|
||||
// assert h.keys() == ['Hello'] // takes the first occurrence XTODO
|
||||
assert h.keys() == ['hello'] // takes the first occurrence
|
||||
}
|
||||
|
||||
fn test_coerce_canonicalize_custom() {
|
||||
@ -200,12 +177,6 @@ fn test_coerce_canonicalize_custom() {
|
||||
h.add_custom('FOO-bar', 'bar')!
|
||||
assert h.custom_values('foo-bar') == ['foo', 'bar']
|
||||
assert h.keys().len == 2
|
||||
|
||||
/*
|
||||
h.coerce(canonicalize: true)
|
||||
assert h.custom_values('foo-bar') == ['foo', 'bar']
|
||||
assert h.keys() == ['Foo-Bar'] // capitalizes the header
|
||||
*/
|
||||
}
|
||||
|
||||
fn test_render_version() {
|
||||
|
@ -30,7 +30,6 @@ mut:
|
||||
state ServerStatus = .closed
|
||||
pub mut:
|
||||
addr string = ':${default_server_port}'
|
||||
port int = default_server_port @[deprecated: 'use addr']
|
||||
handler Handler = DebugHandler{}
|
||||
read_timeout time.Duration = 30 * time.second
|
||||
write_timeout time.Duration = 30 * time.second
|
||||
@ -53,12 +52,6 @@ pub fn (mut s Server) listen_and_serve() {
|
||||
eprintln('Server handler not set, using debug handler')
|
||||
}
|
||||
|
||||
// remove when s.port is removed
|
||||
addr := s.addr.split(':')
|
||||
if addr.len > 1 && s.port != default_server_port {
|
||||
s.addr = '${addr[0]}:${s.port}'
|
||||
}
|
||||
|
||||
mut l := s.listener.addr() or {
|
||||
eprintln('Failed getting listener address, err: ${err}')
|
||||
return
|
||||
|
@ -707,7 +707,6 @@ pub mut:
|
||||
is_conditional bool // true for `[if abc]fn(){}`
|
||||
ctdefine_idx int // the index of the attribute, containing the compile time define [if mytag]
|
||||
from_embedded_type Type // for interface only, fn from the embedded interface
|
||||
from_embeded_type Type @[deprecated: 'use from_embedded_type instead'; deprecated_after: '2024-03-31']
|
||||
//
|
||||
is_expand_simple_interpolation bool // for tagging b.f(s string), which is then called with `b.f('some $x $y')`,
|
||||
// when that call, should be expanded to `b.f('some '); b.f(x); b.f(' '); b.f(y);`
|
||||
|
Loading…
x
Reference in New Issue
Block a user