mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: add cmd/tools/show_ancient_deprecations.v, to cleanup ancient functionality, deprecated over an year ago (#18946)
This commit is contained in:
@@ -17,19 +17,6 @@ mut:
|
||||
done() chan int
|
||||
}
|
||||
|
||||
[deprecated]
|
||||
pub fn cancel(mut ctx Context) {
|
||||
match mut ctx {
|
||||
CancelContext {
|
||||
ctx.cancel(true, canceled)
|
||||
}
|
||||
TimerContext {
|
||||
ctx.cancel(true, canceled)
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
// A CancelContext can be canceled. When canceled, it also cancels any children
|
||||
// that implement Canceler.
|
||||
pub struct CancelContext {
|
||||
|
||||
101
vlib/gg/draw.c.v
101
vlib/gg/draw.c.v
@@ -958,104 +958,3 @@ pub fn (ctx &Context) draw_cubic_bezier_in_steps(points []f32, steps u32, c gx.C
|
||||
|
||||
sgl.end()
|
||||
}
|
||||
|
||||
//---- deprecated
|
||||
|
||||
// Sets a pixel
|
||||
[deprecated: 'use draw_pixel() instead']
|
||||
pub fn (ctx &Context) set_pixel(x f32, y f32, c gx.Color) {
|
||||
ctx.draw_pixel(x, y, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_pixels() instead']
|
||||
pub fn (ctx &Context) set_pixels(points []f32, c gx.Color) {
|
||||
ctx.draw_pixels(points, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_poly_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_poly(points []f32, c gx.Color) {
|
||||
ctx.draw_poly_empty(points, c)
|
||||
}
|
||||
|
||||
// TODO: Fix alpha
|
||||
[deprecated: 'use draw_rect_filled() instead']
|
||||
pub fn (ctx &Context) draw_rect(x f32, y f32, w f32, h f32, c gx.Color) {
|
||||
ctx.draw_rect_filled(x, y, w, h, c)
|
||||
}
|
||||
|
||||
// Draws the outline of a rectangle
|
||||
[deprecated: 'use draw_rect_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_rect(x f32, y f32, w f32, h f32, c gx.Color) {
|
||||
ctx.draw_rect_empty(x, y, w, h, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_rounded_rect_empty()']
|
||||
pub fn (ctx &Context) draw_empty_rounded_rect(x f32, y f32, w f32, h f32, radius f32, c gx.Color) {
|
||||
ctx.draw_rounded_rect_empty(x, y, w, h, radius, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_rounded_rect_filled()']
|
||||
pub fn (ctx &Context) draw_rounded_rect(x f32, y f32, w f32, h f32, radius f32, c gx.Color) {
|
||||
ctx.draw_rounded_rect_filled(x, y, w, h, radius, c)
|
||||
}
|
||||
|
||||
// Draws the outline of a triangle
|
||||
[deprecated: 'use draw_triangle_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_triangle(x f32, y f32, x2 f32, y2 f32, x3 f32, y3 f32, c gx.Color) {
|
||||
ctx.draw_triangle_empty(x, y, x2, y2, x3, y3, c)
|
||||
}
|
||||
|
||||
// Draws a filled triangle
|
||||
[deprecated: 'use draw_triangle_filled() instead']
|
||||
pub fn (ctx &Context) draw_triangle(x f32, y f32, x2 f32, y2 f32, x3 f32, y3 f32, c gx.Color) {
|
||||
ctx.draw_triangle_filled(x, y, x2, y2, x3, y3, c)
|
||||
}
|
||||
|
||||
// Draws the outline of a square
|
||||
[deprecated: 'use draw_square_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_square(x f32, y f32, s f32, c gx.Color) {
|
||||
ctx.draw_square_empty(x, y, s, c)
|
||||
}
|
||||
|
||||
// Draws a filled square
|
||||
[deprecated: 'use draw_square_filled() instead']
|
||||
pub fn (ctx &Context) draw_square(x f32, y f32, s f32, c gx.Color) {
|
||||
ctx.draw_square_filled(x, y, s, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_circle_filled() instead']
|
||||
pub fn (ctx &Context) draw_circle(x f32, y f32, radius f32, c gx.Color) {
|
||||
ctx.draw_circle_filled(x, y, radius, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_slice_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_slice(x f32, y f32, radius f32, start_angle f32, end_angle f32, segments int, c gx.Color) {
|
||||
ctx.draw_slice_empty(x, y, radius, start_angle, end_angle, segments, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_slice_filled() instead']
|
||||
pub fn (ctx &Context) draw_slice(x f32, y f32, radius f32, start_angle f32, end_angle f32, segments int, c gx.Color) {
|
||||
ctx.draw_slice_filled(x, y, radius, start_angle, end_angle, segments, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_arc_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_arc(x f32, y f32, inner_radius f32, thickness f32, start_angle f32, end_angle f32, segments int, c gx.Color) {
|
||||
ctx.draw_arc_empty(x, y, inner_radius, thickness, start_angle, end_angle, segments,
|
||||
c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_arc_filled() instead']
|
||||
pub fn (ctx &Context) draw_arc(x f32, y f32, inner_radius f32, thickness f32, start_angle f32, end_angle f32, segments int, c gx.Color) {
|
||||
ctx.draw_arc_filled(x, y, inner_radius, thickness, start_angle, end_angle, segments,
|
||||
c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_ellipse_empty() instead']
|
||||
pub fn (ctx &Context) draw_empty_ellipse(x f32, y f32, rw f32, rh f32, c gx.Color) {
|
||||
ctx.draw_ellipse_empty(x, y, rw, rh, c)
|
||||
}
|
||||
|
||||
[deprecated: 'use draw_ellipse_filled() instead']
|
||||
pub fn (ctx &Context) draw_ellipse(x f32, y f32, rw f32, rh f32, c gx.Color) {
|
||||
ctx.draw_ellipse_filled(x, y, rw, rh, c)
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
module math
|
||||
|
||||
[deprecated: 'use math.abs() instead']
|
||||
pub fn fabs(x f64) f64 {
|
||||
if x > 0.0 {
|
||||
return x
|
||||
}
|
||||
return -x
|
||||
}
|
||||
@@ -84,7 +84,7 @@ pub fn approximate_with_eps(val f64, eps f64) Fraction {
|
||||
if eps < 0.0 {
|
||||
panic('Epsilon value cannot be negative.')
|
||||
}
|
||||
if math.fabs(val) > math.max_i64 {
|
||||
if math.abs(val) > math.max_i64 {
|
||||
panic('Value out of range.')
|
||||
}
|
||||
// The integer part is separated first. Then we process the fractional
|
||||
@@ -110,7 +110,7 @@ pub fn approximate_with_eps(val f64, eps f64) Fraction {
|
||||
// eval_cf is called often so it needs to be performant
|
||||
partial = eval_cf(whole, d)
|
||||
// Check if we're done
|
||||
if math.fabs(val - partial.f64()) < eps {
|
||||
if math.abs(val - partial.f64()) < eps {
|
||||
return partial
|
||||
}
|
||||
frac -= f64(den)
|
||||
|
||||
@@ -179,13 +179,6 @@ pub fn url_encode_form_data(data map[string]string) string {
|
||||
return pieces.join('&')
|
||||
}
|
||||
|
||||
[deprecated: 'use fetch()']
|
||||
fn fetch_with_method(method Method, _config FetchConfig) !Response {
|
||||
mut config := _config
|
||||
config.method = method
|
||||
return fetch(config)
|
||||
}
|
||||
|
||||
fn build_url_from_fetch(config FetchConfig) !string {
|
||||
mut url := urllib.parse(config.url)!
|
||||
if config.params.len == 0 {
|
||||
@@ -202,23 +195,3 @@ fn build_url_from_fetch(config FetchConfig) !string {
|
||||
url.raw_query = query
|
||||
return url.str()
|
||||
}
|
||||
|
||||
[deprecated: 'unescape_url is deprecated, use urllib.query_unescape() instead']
|
||||
pub fn unescape_url(s string) string {
|
||||
panic('http.unescape_url() was replaced with urllib.query_unescape()')
|
||||
}
|
||||
|
||||
[deprecated: 'escape_url is deprecated, use urllib.query_escape() instead']
|
||||
pub fn escape_url(s string) string {
|
||||
panic('http.escape_url() was replaced with urllib.query_escape()')
|
||||
}
|
||||
|
||||
[deprecated: 'unescape is deprecated, use urllib.query_escape() instead']
|
||||
pub fn unescape(s string) string {
|
||||
panic('http.unescape() was replaced with http.unescape_url()')
|
||||
}
|
||||
|
||||
[deprecated: 'escape is deprecated, use urllib.query_unescape() instead']
|
||||
pub fn escape(s string) string {
|
||||
panic('http.escape() was replaced with http.escape_url()')
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import strconv
|
||||
pub struct Response {
|
||||
pub mut:
|
||||
body string
|
||||
text string [deprecated: 'use Response.body instead'; deprecated_after: '2022-10-03']
|
||||
header Header
|
||||
status_code int
|
||||
status_msg string
|
||||
@@ -50,7 +49,6 @@ pub fn parse_response(resp string) !Response {
|
||||
status_msg: status_msg
|
||||
header: header
|
||||
body: body
|
||||
text: body // TODO: remove as depreciated
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,14 +116,13 @@ pub struct ResponseConfig {
|
||||
status Status = .ok
|
||||
header Header
|
||||
body string
|
||||
text string [deprecated: 'use ResponseConfig.body instead'; deprecated_after: '2022-10-03']
|
||||
}
|
||||
|
||||
// new_response creates a Response object from the configuration. This
|
||||
// function will add a Content-Length header if body is not empty.
|
||||
pub fn new_response(conf ResponseConfig) Response {
|
||||
mut resp := Response{
|
||||
body: conf.body + conf.text
|
||||
body: conf.body
|
||||
header: conf.header
|
||||
}
|
||||
if resp.body.len > 0 && !resp.header.contains(.content_length) {
|
||||
|
||||
@@ -3,7 +3,7 @@ module http
|
||||
fn test_response_bytestr_1() {
|
||||
resp := new_response(
|
||||
status: .ok
|
||||
text: 'Foo' // TODO: replace with `body` once deprecaped
|
||||
body: 'Foo'
|
||||
)
|
||||
assert resp.bytestr() == 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 3\r\n' + '\r\n' + 'Foo'
|
||||
}
|
||||
@@ -43,5 +43,4 @@ fn test_parse_response() {
|
||||
assert x.header.contains(.content_length)
|
||||
assert x.header.get(.content_length)! == '3'
|
||||
assert x.body == 'Foo'
|
||||
assert x.text == 'Foo'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user