mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
parser: make old [attr] syntax an error
This commit is contained in:
parent
11c59cf8b9
commit
f9d3bd39a6
2 changed files with 6 additions and 3 deletions
|
@ -75,7 +75,7 @@ fn check_assert_continues_works() ! {
|
|||
result.has('assert_continues_option_works_test.v:5: fn test_fail2')
|
||||
result.has('> assert 2 == 4').has('> assert 2 == 1').has('> assert 2 == 0')
|
||||
// Check if a test function, tagged with [assert_continues], has the same behaviour, without needing additional options
|
||||
create_test('assert_continues_tag_works_test.v', '[assert_continues]fn test_fail1() { assert 2==4\nassert 2==1\nassert 2==0 }\nfn test_ok(){ assert true }\nfn test_fail2() { assert false\n assert false }')!
|
||||
create_test('assert_continues_tag_works_test.v', '@[assert_continues]fn test_fail1() { assert 2==4\nassert 2==1\nassert 2==0 }\nfn test_ok(){ assert true }\nfn test_fail2() { assert false\n assert false }')!
|
||||
tag_res := check_fail('${vexe} assert_continues_tag_works_test.v')
|
||||
tag_res.has('assert_continues_tag_works_test.v:1: fn test_fail1')
|
||||
tag_res.has('assert_continues_tag_works_test.v:2: fn test_fail1')
|
||||
|
|
|
@ -1937,12 +1937,15 @@ fn (mut p Parser) is_attributes() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// when is_top_stmt is true attrs are added to p.attrs
|
||||
// when is_top_stmt is true, attrs are added to p.attrs
|
||||
fn (mut p Parser) attributes() {
|
||||
start_pos := p.tok.pos()
|
||||
mut is_at := false
|
||||
if p.tok.kind == .lsbr {
|
||||
p.warn('`[attr]` has been deprecated, use `@[attr]` instead')
|
||||
if p.pref.is_fmt {
|
||||
} else {
|
||||
p.error('`[attr]` has been deprecated, use `@[attr]` instead')
|
||||
}
|
||||
// [attr]
|
||||
p.check(.lsbr)
|
||||
} else if p.tok.kind == .at {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue