mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: allow << >> with enums
This commit is contained in:
parent
a329104dcb
commit
a8b5c00939
|
@ -416,8 +416,11 @@ fn (p mut Parser) expression() string {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if !is_integer_type(typ) {
|
if !is_integer_type(typ) {
|
||||||
|
t := p.table.find_type(typ)
|
||||||
|
if t.cat != .enum_ {
|
||||||
p.error('cannot use shift operator on non-integer type `$typ`')
|
p.error('cannot use shift operator on non-integer type `$typ`')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
p.next()
|
p.next()
|
||||||
p.gen(' << ')
|
p.gen(' << ')
|
||||||
p.check_types(p.expression(), 'integer')
|
p.check_types(p.expression(), 'integer')
|
||||||
|
@ -426,8 +429,11 @@ fn (p mut Parser) expression() string {
|
||||||
}
|
}
|
||||||
if p.tok == .righ_shift {
|
if p.tok == .righ_shift {
|
||||||
if !is_integer_type(typ) {
|
if !is_integer_type(typ) {
|
||||||
|
t := p.table.find_type(typ)
|
||||||
|
if t.cat != .enum_ {
|
||||||
p.error('cannot use shift operator on non-integer type `$typ`')
|
p.error('cannot use shift operator on non-integer type `$typ`')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
p.next()
|
p.next()
|
||||||
p.gen(' >> ')
|
p.gen(' >> ')
|
||||||
p.check_types(p.expression(), 'integer')
|
p.check_types(p.expression(), 'integer')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user