Add a "status" type and "try" keyword.

This commit is contained in:
Nigel Tao committed 2017-09-01 16:41:42 +10:00
1 parent 363dcbe714
commit 935cd73686
11 files changed
+94 -24

No files matched your search

+2
View File
@@ -201,6 +201,8 @@ const MaxExprDepth = 255
//
// For function calls, like "LHS(List0)", ID0 is IDOpenParen.
//
// For try/function calls, like "try LHS(List0)", ID0 is IDTry.
//
// For indexes, like "LHS[RHS]", ID0 is IDOpenBracket.
//
// For slices, like "LHS[MHS:RHS]", ID0 is IDColon.
+5 -1
View File
@@ -31,6 +31,10 @@ func (n *Expr) appendString(buf []byte, tm *t.Map, parenthesize bool, depth uint
case 0:
buf = append(buf, tm.ByID(n.id1)...)
case t.KeyTry:
buf = append(buf, "try "...)
fallthrough
case t.KeyOpenParen:
buf = n.lhs.Expr().appendString(buf, tm, true, depth)
if n.flags&FlagsSuspendible != 0 {
@@ -77,7 +81,7 @@ func (n *Expr) appendString(buf []byte, tm *t.Map, parenthesize bool, depth uint
buf = append(buf, ')')
case t.KeyLimit:
// TODO.
buf = append(buf, "TODO(limit)"...)
}
case t.FlagsUnaryOp: