Remove token ID/Key distinction, part 2 of N

This commit is contained in:
Nigel Tao committed 2018-04-15 10:58:53 +10:00
1 parent afd7429e9a
commit 7007682182
6 files changed
+67 -61

No files matched your search

+5 -5
View File
@@ -36,8 +36,8 @@ func (n *Expr) appendStr(buf []byte, tm *t.Map, parenthesize bool, depth uint32)
depth++
if n != nil {
switch n.id0.Flags() & (t.FlagsUnaryOp | t.FlagsBinaryOp | t.FlagsAssociativeOp) {
case 0:
switch {
default:
switch n.id0.Key() {
case t.KeyError, t.KeyStatus, t.KeySuspension:
switch n.id0.Key() {
@@ -109,11 +109,11 @@ func (n *Expr) appendStr(buf []byte, tm *t.Map, parenthesize bool, depth uint32)
buf = append(buf, ')')
}
case t.FlagsUnaryOp:
case n.id0.IsXUnaryOp():
buf = append(buf, opStrings[0xFF&n.id0.Key()]...)
buf = n.rhs.Expr().appendStr(buf, tm, true, depth)
case t.FlagsBinaryOp:
case n.id0.IsXBinaryOp():
if parenthesize {
buf = append(buf, '(')
}
@@ -128,7 +128,7 @@ func (n *Expr) appendStr(buf []byte, tm *t.Map, parenthesize bool, depth uint32)
buf = append(buf, ')')
}
case t.FlagsAssociativeOp:
case n.id0.IsXAssociativeOp():
if parenthesize {
buf = append(buf, '(')
}