mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: uniform handling of enum field format
This commit is contained in:
parent
81ed6ad2a1
commit
5481c0fc84
@ -1,14 +1,14 @@
|
||||
vlib/v/checker/tests/enum_err.v:4:13: error: default value for enum has to be an integer
|
||||
2|
|
||||
3| enum Color {
|
||||
4| green = 'green',
|
||||
4| green = 'green'
|
||||
~~~~~~~
|
||||
5| yellow = 1+1,
|
||||
6| blue,
|
||||
5| yellow = 1+1
|
||||
6| blue
|
||||
vlib/v/checker/tests/enum_err.v:5:14: error: default value for enum has to be an integer
|
||||
3| enum Color {
|
||||
4| green = 'green',
|
||||
5| yellow = 1+1,
|
||||
4| green = 'green'
|
||||
5| yellow = 1+1
|
||||
~~~
|
||||
6| blue,
|
||||
6| blue
|
||||
7| }
|
||||
|
@ -1,9 +1,9 @@
|
||||
module main
|
||||
|
||||
enum Color {
|
||||
green = 'green',
|
||||
yellow = 1+1,
|
||||
blue,
|
||||
green = 'green'
|
||||
yellow = 1+1
|
||||
blue
|
||||
}
|
||||
|
||||
fn main(){
|
||||
|
@ -1126,13 +1126,6 @@ fn (mut p Parser) enum_decl() ast.EnumDecl {
|
||||
expr: expr
|
||||
has_expr: has_expr
|
||||
}
|
||||
// Allow commas after enum, helpful for
|
||||
// enum Color {
|
||||
// r,g,b
|
||||
// }
|
||||
if p.tok.kind == .comma {
|
||||
p.next()
|
||||
}
|
||||
}
|
||||
p.check(.rcbr)
|
||||
p.table.register_type_symbol(table.TypeSymbol{
|
||||
|
Loading…
Reference in New Issue
Block a user