mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
match: else
This commit is contained in:
parent
76d6e9fd1a
commit
14ad70d3a0
@ -3044,8 +3044,13 @@ fn (p mut Parser) switch_statement() {
|
||||
for p.tok == .key_case || p.tok == .key_default || p.peek() == .arrow || p.tok == .key_else {
|
||||
if p.tok == .key_default || p.tok == .key_else {
|
||||
p.genln('else { // default:')
|
||||
if p.tok == .key_default {
|
||||
p.check(.key_default)
|
||||
p.check(.colon)
|
||||
} else {
|
||||
p.check(.key_else)
|
||||
p.check(.arrow)
|
||||
}
|
||||
p.statements()
|
||||
break
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ fn test_match() {
|
||||
3 => println('three')
|
||||
b = 3
|
||||
4 => println('four')
|
||||
else => println('???')
|
||||
}
|
||||
assert b == 3
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user