Skip to content

Commit 6b92f8f

Browse files
all: remove ancient deprecations (#23479)
1 parent 40b574b commit 6b92f8f

27 files changed

Lines changed: 26 additions & 383 deletions

File tree

‎vlib/builtin/js/string.js.v‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,6 @@ fn (s string) index_last_(p string) int {
789789
return -1
790790
}
791791

792-
// index_last returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
793-
@[deprecated: 'use `.last_index(needle string)` instead']
794-
pub fn (s string) index_last(needle string) ?int {
795-
return s.last_index(needle)
796-
}
797-
798792
// last_index returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
799793
@[inline]
800794
pub fn (s string) last_index(needle string) ?int {
@@ -805,15 +799,6 @@ pub fn (s string) last_index(needle string) ?int {
805799
return idx
806800
}
807801

808-
// index_u8_last returns the index of the *last* occurrence of the byte `c` (if found) in the string.
809-
// It returns -1, if `c` is not found.
810-
@[deprecated: 'use `.last_index_u8(c u8)` instead']
811-
@[deprecated_after: '2024-06-30']
812-
@[inline]
813-
pub fn (s string) index_u8_last(c u8) int {
814-
return s.last_index_u8(c)
815-
}
816-
817802
// last_index_u8 returns the index of the last occurrence of byte `c` if it was found in the string.
818803
@[direct_array_access]
819804
pub fn (s string) last_index_u8(c u8) int {

‎vlib/builtin/string.v‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,13 +1249,6 @@ pub fn (s string) index(p string) ?int {
12491249
return idx
12501250
}
12511251

1252-
// index_last returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
1253-
@[deprecated: 'use `.last_index(needle string)` instead']
1254-
@[deprecated_after: '2024-03-27']
1255-
pub fn (s string) index_last(needle string) ?int {
1256-
return s.last_index(needle)
1257-
}
1258-
12591252
// last_index returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
12601253
@[inline]
12611254
pub fn (s string) last_index(needle string) ?int {
@@ -1386,15 +1379,6 @@ pub fn (s string) index_u8(c u8) int {
13861379
return -1
13871380
}
13881381

1389-
// index_u8_last returns the index of the *last* occurrence of the byte `c` (if found) in the string.
1390-
// It returns -1, if `c` is not found.
1391-
@[deprecated: 'use `.last_index_u8(c u8)` instead']
1392-
@[deprecated_after: '2024-06-30']
1393-
@[inline]
1394-
pub fn (s string) index_u8_last(c u8) int {
1395-
return s.last_index_u8(c)
1396-
}
1397-
13981382
// last_index_u8 returns the index of the last occurrence of byte `c` if it was found in the string.
13991383
@[direct_array_access; inline]
14001384
pub fn (s string) last_index_u8(c u8) int {

‎vlib/crypto/md5/md5.v‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,16 @@ pub fn (mut d Digest) write(p_ []u8) !int {
108108
pub fn (d &Digest) sum(b_in []u8) []u8 {
109109
// Make a copy of d so that caller can keep writing and summing.
110110
mut d0 := d.clone()
111-
hash := d0.checksum_internal()
111+
hash := d0.checksum()
112112
mut b_out := b_in.clone()
113113
for b in hash {
114114
b_out << b
115115
}
116116
return b_out
117117
}
118118

119-
// TODO:
120-
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
121-
fn (mut d Digest) checksum_internal() []u8 {
119+
// checksum returns the byte checksum of the `Digest`,
120+
fn (mut d Digest) checksum() []u8 {
122121
// Append 0x80 to the end of the message and then append zeros
123122
// until the length is a multiple of 56 bytes. Finally append
124123
// 8 bytes representing the message length in bits.
@@ -143,19 +142,11 @@ fn (mut d Digest) checksum_internal() []u8 {
143142
return digest
144143
}
145144

146-
// checksum returns the byte checksum of the `Digest`,
147-
// it is an internal method and is not recommended because its results are not idempotent.
148-
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
149-
@[deprecated_after: '2024-04-30']
150-
pub fn (mut d Digest) checksum() []u8 {
151-
return d.checksum_internal()
152-
}
153-
154145
// sum returns the MD5 checksum of the data.
155146
pub fn sum(data []u8) []u8 {
156147
mut d := new()
157148
d.write(data) or { panic(err) }
158-
return d.checksum_internal()
149+
return d.checksum()
159150
}
160151

161152
fn block(mut dig Digest, p []u8) {

‎vlib/crypto/pem/pem.v‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ const pem_end = '\n-----END '
77
const pem_eol = '-----'
88
const colon = ':'
99

10-
// new returns a new `Block` with the specified block_type
11-
@[deprecated: 'use Block.new instead']
12-
@[inline]
13-
pub fn new(block_type string) Block {
14-
return Block.new(block_type)
15-
}
16-
1710
@[params]
1811
pub struct EncodeConfig {
1912
pub mut:

‎vlib/crypto/sha1/sha1.v‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,16 @@ pub fn (mut d Digest) write(p_ []u8) !int {
115115
pub fn (d &Digest) sum(b_in []u8) []u8 {
116116
// Make a copy of d so that caller can keep writing and summing.
117117
mut d0 := d.clone()
118-
hash := d0.checksum_internal()
118+
hash := d0.checksum()
119119
mut b_out := b_in.clone()
120120
for b in hash {
121121
b_out << b
122122
}
123123
return b_out
124124
}
125125

126-
// TODO:
127-
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
128-
fn (mut d Digest) checksum_internal() []u8 {
126+
// checksum returns the current byte checksum of the `Digest`,
127+
fn (mut d Digest) checksum() []u8 {
129128
mut len := d.len
130129
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
131130
mut tmp := []u8{len: (64)}
@@ -148,19 +147,11 @@ fn (mut d Digest) checksum_internal() []u8 {
148147
return digest
149148
}
150149

151-
// checksum returns the current byte checksum of the `Digest`,
152-
// it is an internal method and is not recommended because its results are not idempotent.
153-
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
154-
@[deprecated_after: '2024-04-30']
155-
pub fn (mut d Digest) checksum() []u8 {
156-
return d.checksum_internal()
157-
}
158-
159150
// sum returns the SHA-1 checksum of the bytes passed in `data`.
160151
pub fn sum(data []u8) []u8 {
161152
mut d := new()
162153
d.write(data) or { panic(err) }
163-
return d.checksum_internal()
154+
return d.checksum()
164155
}
165156

166157
fn block(mut dig Digest, p []u8) {

‎vlib/crypto/sha256/sha256.v‎

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
149149
pub fn (d &Digest) sum(b_in []u8) []u8 {
150150
// Make a copy of d so that caller can keep writing and summing.
151151
mut d0 := d.clone()
152-
hash := d0.checksum_internal()
152+
hash := d0.checksum()
153153
mut b_out := b_in.clone()
154154
if d0.is224 {
155155
for b in hash[..size224] {
@@ -163,9 +163,9 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
163163
return b_out
164164
}
165165

166-
// TODO:
167-
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
168-
fn (mut d Digest) checksum_internal() []u8 {
166+
// checksum returns the current byte checksum of the Digest,
167+
// it is an internal method and is not recommended because its results are not idempotent.
168+
fn (mut d Digest) checksum() []u8 {
169169
mut len := d.len
170170
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
171171
mut tmp := []u8{len: (64)}
@@ -196,20 +196,6 @@ fn (mut d Digest) checksum_internal() []u8 {
196196
return digest
197197
}
198198

199-
// checksum returns the current byte checksum of the Digest,
200-
// it is an internal method and is not recommended because its results are not idempotent.
201-
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
202-
@[deprecated_after: '2024-04-30']
203-
pub fn (mut d Digest) checksum() []u8 {
204-
out := d.checksum_internal()
205-
// if this digest has `size224` length, return the correct `size224` checksum
206-
if d.is224 {
207-
return out[0..size224]
208-
}
209-
// otherwise, returns a normal size
210-
return out
211-
}
212-
213199
// sum returns the SHA256 checksum of the bytes in `data`.
214200
// Example: assert sha256.sum('V'.bytes()).len > 0 == true
215201
pub fn sum(data []u8) []u8 {
@@ -220,14 +206,14 @@ pub fn sum(data []u8) []u8 {
220206
pub fn sum256(data []u8) []u8 {
221207
mut d := new()
222208
d.write(data) or { panic(err) }
223-
return d.checksum_internal()
209+
return d.checksum()
224210
}
225211

226212
// sum224 returns the SHA224 checksum of the data.
227213
pub fn sum224(data []u8) []u8 {
228214
mut d := new224()
229215
d.write(data) or { panic(err) }
230-
sum := d.checksum_internal()
216+
sum := d.checksum()
231217
mut sum224 := []u8{len: size224}
232218
copy(mut sum224, sum[..size224])
233219
return sum224

‎vlib/crypto/sha512/sha512.v‎

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
208208
pub fn (d &Digest) sum(b_in []u8) []u8 {
209209
// Make a copy of d so that caller can keep writing and summing.
210210
mut d0 := d.clone()
211-
hash := d0.checksum_internal()
211+
hash := d0.checksum()
212212
mut b_out := b_in.clone()
213213
match d0.function {
214214
.sha384 {
@@ -235,9 +235,9 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
235235
return b_out
236236
}
237237

238-
// TODO:
239-
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
240-
fn (mut d Digest) checksum_internal() []u8 {
238+
// checksum returns the current byte checksum of the Digest,
239+
// it is an internal method and is not recommended because its results are not idempotent.
240+
fn (mut d Digest) checksum() []u8 {
241241
// Padding. Add a 1 bit and 0 bits until 112 bytes mod 128.
242242
mut len := d.len
243243
mut tmp := []u8{len: (128)}
@@ -269,40 +269,18 @@ fn (mut d Digest) checksum_internal() []u8 {
269269
return digest
270270
}
271271

272-
// checksum returns the current byte checksum of the Digest,
273-
// it is an internal method and is not recommended because its results are not idempotent.
274-
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
275-
@[deprecated_after: '2024-04-30']
276-
pub fn (mut d Digest) checksum() []u8 {
277-
out := d.checksum_internal()
278-
match d.function {
279-
.sha384 {
280-
return out[0..size384]
281-
}
282-
.sha512_224 {
283-
return out[0..size224]
284-
}
285-
.sha512_256 {
286-
return out[0..size256]
287-
}
288-
else {
289-
return out
290-
}
291-
}
292-
}
293-
294272
// sum512 returns the SHA512 checksum of the data.
295273
pub fn sum512(data []u8) []u8 {
296274
mut d := new_digest(.sha512)
297275
d.write(data) or { panic(err) }
298-
return d.checksum_internal()
276+
return d.checksum()
299277
}
300278

301279
// sum384 returns the SHA384 checksum of the data.
302280
pub fn sum384(data []u8) []u8 {
303281
mut d := new_digest(.sha384)
304282
d.write(data) or { panic(err) }
305-
sum := d.checksum_internal()
283+
sum := d.checksum()
306284
mut sum384 := []u8{len: size384}
307285
copy(mut sum384, sum[..size384])
308286
return sum384
@@ -312,7 +290,7 @@ pub fn sum384(data []u8) []u8 {
312290
pub fn sum512_224(data []u8) []u8 {
313291
mut d := new_digest(.sha512_224)
314292
d.write(data) or { panic(err) }
315-
sum := d.checksum_internal()
293+
sum := d.checksum()
316294
mut sum224 := []u8{len: size224}
317295
copy(mut sum224, sum[..size224])
318296
return sum224
@@ -322,7 +300,7 @@ pub fn sum512_224(data []u8) []u8 {
322300
pub fn sum512_256(data []u8) []u8 {
323301
mut d := new_digest(.sha512_256)
324302
d.write(data) or { panic(err) }
325-
sum := d.checksum_internal()
303+
sum := d.checksum()
326304
mut sum256 := []u8{len: size256}
327305
copy(mut sum256, sum[..size256])
328306
return sum256

‎vlib/math/big/big.js.v‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ pub fn div_mod(a &Number, b &Number) (Number, Number) {
9797
return c, d
9898
}
9999

100-
@[deprecated: 'use div_mod(a, b) instead']
101-
pub fn divmod(a &Number, b &Number) (Number, Number) {
102-
return div_mod(a, b)
103-
}
104-
105100
pub fn cmp(a &Number, b &Number) int {
106101
res := 0
107102

@@ -142,21 +137,6 @@ pub fn (a &Number) isqrt() Number {
142137
return b
143138
}
144139

145-
@[deprecated: 'use bitwise_and(a, b) instead']
146-
pub fn b_and(a &Number, b &Number) Number {
147-
return bitwise_and(a, b)
148-
}
149-
150-
@[deprecated: 'use bitwise_or(a, b) instead']
151-
pub fn b_or(a &Number, b &Number) Number {
152-
return bitwise_or(a, b)
153-
}
154-
155-
@[deprecated: 'use bitwise_xor(a, b) instead']
156-
pub fn b_xor(a &Number, b &Number) Number {
157-
return bitwise_xor(a, b)
158-
}
159-
160140
pub fn bitwise_and(a &Number, b &Number) Number {
161141
c := Number{}
162142
#c.value = a.val.value & b.val.value
@@ -178,16 +158,6 @@ pub fn bitwise_xor(a &Number, b &Number) Number {
178158
return c
179159
}
180160

181-
@[deprecated: 'use a.left_shift(amount) instead']
182-
pub fn (a &Number) lshift(amount int) Number {
183-
return a.left_shift(amount)
184-
}
185-
186-
@[deprecated: 'use a.right_shift(amount) instead']
187-
pub fn (a &Number) rshift(amount int) Number {
188-
return a.right_shift(amount)
189-
}
190-
191161
pub fn (a &Number) left_shift(amount int) Number {
192162
c := Number{}
193163
#c.value = a.val.value << BigInt(+amount)
@@ -223,11 +193,6 @@ pub fn factorial(nn &Number) Number {
223193
return a
224194
}
225195

226-
@[deprecated: 'use factorial_int instead']
227-
pub fn fact(n int) Number {
228-
return factorial_int(n)
229-
}
230-
231196
pub fn factorial_int(n int) Number {
232197
return factorial(from_int(n))
233198
}

0 commit comments

Comments
 (0)