mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Rename PackageOrDecorator to Decorator.
This commit is contained in:
1 parent
aed3aa9925
commit
ebf3713555
6 files changed
+24
-24
No files matched your search
+9
-9
@@ -440,7 +440,7 @@ func NewJump(keyword t.ID, label t.ID) *Jump {
|
||||
// MaxTypeExprDepth is an advisory limit for a TypeExpr's recursion depth.
|
||||
const MaxTypeExprDepth = 63
|
||||
|
||||
// TypeExpr is a type expression, such as "u32", "u32[:8]", "pkg.foo", "ptr T"
|
||||
// TypeExpr is a type expression, such as "u32", "u32[..8]", "pkg.foo", "ptr T"
|
||||
// or "[8] T":
|
||||
// - ID0: <0|package name|IDPtr|IDOpenBracket>
|
||||
// - ID1: <0|type name>
|
||||
@@ -460,14 +460,14 @@ const MaxTypeExprDepth = 63
|
||||
// TODO: function / method types.
|
||||
type TypeExpr Node
|
||||
|
||||
func (n *TypeExpr) Node() *Node { return (*Node)(n) }
|
||||
func (n *TypeExpr) PackageOrDecorator() t.ID { return n.id0 }
|
||||
func (n *TypeExpr) Name() t.ID { return n.id1 }
|
||||
func (n *TypeExpr) ArrayLength() *Expr { return n.lhs.Expr() }
|
||||
func (n *TypeExpr) Bounds() [2]*Expr { return [2]*Expr{n.lhs.Expr(), n.mhs.Expr()} }
|
||||
func (n *TypeExpr) Min() *Expr { return n.lhs.Expr() }
|
||||
func (n *TypeExpr) Max() *Expr { return n.mhs.Expr() }
|
||||
func (n *TypeExpr) Inner() *TypeExpr { return n.rhs.TypeExpr() }
|
||||
func (n *TypeExpr) Node() *Node { return (*Node)(n) }
|
||||
func (n *TypeExpr) Decorator() t.ID { return n.id0 }
|
||||
func (n *TypeExpr) Name() t.ID { return n.id1 }
|
||||
func (n *TypeExpr) ArrayLength() *Expr { return n.lhs.Expr() }
|
||||
func (n *TypeExpr) Bounds() [2]*Expr { return [2]*Expr{n.lhs.Expr(), n.mhs.Expr()} }
|
||||
func (n *TypeExpr) Min() *Expr { return n.lhs.Expr() }
|
||||
func (n *TypeExpr) Max() *Expr { return n.mhs.Expr() }
|
||||
func (n *TypeExpr) Inner() *TypeExpr { return n.rhs.TypeExpr() }
|
||||
|
||||
func (n *TypeExpr) IsBool() bool {
|
||||
return n.id0 == 0 && n.id1.Key() == t.KeyBool && n.lhs == nil && n.mhs == nil && n.rhs == nil
|
||||
|
||||
+3
-3
@@ -145,7 +145,7 @@ func (n *TypeExpr) String(tm *t.Map) string {
|
||||
if n == nil {
|
||||
return ""
|
||||
}
|
||||
if n.PackageOrDecorator() == 0 && n.Min() == nil && n.Max() == nil {
|
||||
if n.Decorator() == 0 && n.Min() == nil && n.Max() == nil {
|
||||
return tm.ByID(n.Name())
|
||||
}
|
||||
return string(n.appendString(nil, tm, 0))
|
||||
@@ -160,7 +160,7 @@ func (n *TypeExpr) appendString(buf []byte, tm *t.Map, depth uint32) []byte {
|
||||
return append(buf, "!invalid_type!"...)
|
||||
}
|
||||
|
||||
switch n.PackageOrDecorator().Key() {
|
||||
switch n.Decorator().Key() {
|
||||
case 0:
|
||||
buf = append(buf, tm.ByID(n.Name())...)
|
||||
case t.KeyPtr:
|
||||
@@ -172,7 +172,7 @@ func (n *TypeExpr) appendString(buf []byte, tm *t.Map, depth uint32) []byte {
|
||||
buf = append(buf, "] "...)
|
||||
return n.Inner().appendString(buf, tm, depth)
|
||||
default:
|
||||
buf = append(buf, tm.ByID(n.PackageOrDecorator())...)
|
||||
buf = append(buf, tm.ByID(n.Decorator())...)
|
||||
buf = append(buf, '.')
|
||||
buf = append(buf, tm.ByID(n.Name())...)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user