Follow-up cleanup for https://go-review.googlesource.com/17248:
Use properly typed local variable op now that that variable use
is not overloaded anymore.
Also: Remove unnecessary if stmt from common lexical path.
Change-Id: I984b0b346f3fdccd5aedc937330c0a5f99acf324
Reviewed-on: https://go-review.googlesource.com/17249
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
typ *Type
sym *Sym
val Val
- i int
+ op Op
}
const (
func _yylex(yylval *yySymType) int32 {
var c1 int
+ var op Op
var escflag int
var v int64
var cp *bytes.Buffer
}
if c1 == '=' {
- c = int(ODIV)
+ op = ODIV
goto asop
}
case '*':
c1 = getc()
if c1 == '=' {
- c = int(OMUL)
+ op = OMUL
goto asop
}
case '%':
c1 = getc()
if c1 == '=' {
- c = int(OMOD)
+ op = OMOD
goto asop
}
}
if c1 == '=' {
- c = int(OADD)
+ op = OADD
goto asop
}
}
if c1 == '=' {
- c = int(OSUB)
+ op = OSUB
goto asop
}
c = int(LRSH)
c1 = getc()
if c1 == '=' {
- c = int(ORSH)
+ op = ORSH
goto asop
}
c = int(LLSH)
c1 = getc()
if c1 == '=' {
- c = int(OLSH)
+ op = OLSH
goto asop
}
c = int(LANDNOT)
c1 = getc()
if c1 == '=' {
- c = int(OANDNOT)
+ op = OANDNOT
goto asop
}
}
if c1 == '=' {
- c = int(OAND)
+ op = OAND
goto asop
}
}
if c1 == '=' {
- c = int(OOR)
+ op = OOR
goto asop
}
case '^':
c1 = getc()
if c1 == '=' {
- c = int(OXOR)
+ op = OXOR
goto asop
}
ungetc(c1)
lx:
- if c > 0xff {
- if Debug['x'] != 0 {
+ if Debug['x'] != 0 {
+ if c > 0xff {
fmt.Printf("%v lex: TOKEN %s\n", Ctxt.Line(int(lexlineno)), lexname(c))
- }
- } else {
- if Debug['x'] != 0 {
+ } else {
fmt.Printf("%v lex: TOKEN '%c'\n", Ctxt.Line(int(lexlineno)), c)
}
}
return int32(c)
asop:
- yylval.i = c // rathole to hold which asop
+ yylval.op = op
if Debug['x'] != 0 {
- fmt.Printf("lex: TOKEN ASOP %c\n", c)
+ fmt.Printf("lex: TOKEN ASOP %s=\n", goopnames[op])
}
return LASOP
func (p *parser) next() {
p.tok = yylex(&p.yy)
- p.op = Op(p.yy.i)
+ p.op = p.yy.op
p.val = p.yy.val
p.sym_ = p.yy.sym
}