1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: add support for struct field deprecation (#14527)

This commit is contained in:
Delyan Angelov
2022-05-26 00:44:18 +03:00
committed by GitHub
parent 95cc535fc7
commit 410b57b2fa
13 changed files with 201 additions and 26 deletions

View File

@@ -5905,6 +5905,19 @@ fn main() {
}
```
Struct field deprecations:
```v oksyntax
module abc
// Note that only *direct* accesses to Xyz.d in *other modules*, will produce deprecation notices/warnings:
pub struct Xyz {
pub mut:
a int
d int [deprecated: 'use Xyz.a instead'; deprecated_after: '2999-03-01'] // produce a notice, the deprecation date is in the far future
}
```
Function/method deprecations:
```v
// Calling this function will result in a deprecation warning
[deprecated]