vety-language/demo/annotate.vt

43 lines
765 B
Plaintext

// 测试基础注解
@Test
func testFunction() {
// 函数体
}
// 测试带参数的注解
@Author("John Doe")
@Version(1.35)
let projectVersion = 4;
@Config(key="debug_mode", enabled=true)
let debugSettings = {
logLevel: "verbose",
timeout: 5000
};
// 测试嵌套注解
@Deprecated("Use newMethod instead")
func oldMethod() {
// 已弃用方法
}
// 测试参数化注解组合
@Metrics(track=true, category="performance")
@Retry(maxAttempts=3)
func networkCall() {
// 网络调用逻辑
}
// 测试无参数注解
@ReadOnly
var configData = [1, 2, 3];
// 测试复杂参数结构
@DatabaseConnection(
host="localhost",
port=5432,
options={ssl: true, poolSize: 5}
)
func connectToDatabase() {
// 数据库连接逻辑
}