1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: use the new optimized in

This commit is contained in:
Alexander Medvednikov 2019-10-06 16:55:27 +03:00
parent 5acadbab32
commit 03bc5ab3d5
2 changed files with 3 additions and 10 deletions

View File

@ -296,11 +296,8 @@ fn (p mut Parser) fn_decl() {
}
// Returns a type?
mut typ := 'void'
if p.tok == .name || p.tok == .mul || p.tok == .amp || p.tok == .lsbr ||
p.tok == .question || p.tok == .lpar {
if p.tok in [Token.name, .mul, .amp, .lsbr, .question, .lpar] {
p.fgen(' ')
// TODO In
// if p.tok in [ .name, .mul, .amp, .lsbr ] {
typ = p.get_type()
}
// multiple returns

View File

@ -1584,10 +1584,8 @@ fn (p mut Parser) bterm() string {
is_ustr := typ=='ustring'
is_float := typ=='f64' || typ=='f32'
expr_type := typ
tok := p.tok
// if tok in [ .eq, .gt, .lt, .le, .ge, .ne] {
if tok == .eq || tok == .gt || tok == .lt || tok == .le || tok == .ge || tok == .ne {
if tok in [ .eq, .gt, .lt, .le, .ge, .ne] {
p.fgen(' ${p.tok.str()} ')
if (is_float || is_str || is_ustr) && !p.is_js {
p.gen(',')
@ -2465,9 +2463,7 @@ fn (p mut Parser) expression() string {
return 'int'
}
// + - | ^
for p.tok == .plus || p.tok == .minus || p.tok == .pipe || p.tok == .amp ||
p.tok == .xor {
// for p.tok in [.plus, .minus, .pipe, .amp, .xor] {
for p.tok in [Token.plus, .minus, .pipe, .amp, .xor] {
tok_op := p.tok
if typ == 'bool' {
p.error('operator ${p.tok.str()} not defined on bool ')