Add ast.FlagsTypeChecked.

This commit is contained in:
Nigel Tao committed 2017-05-18 11:03:56 +10:00
1 parent bd6e555cce
commit 15485dadc1
4 files changed
+203 -114

No files matched your search

+10 -1
View File
@@ -67,6 +67,7 @@ type Flags uint32
const (
FlagsSuspendible = Flags(0x00000001)
FlagsTypeChecked = Flags(0x00000002)
)
type Node struct {
@@ -88,7 +89,9 @@ type Node struct {
list1 []*Node
}
func (n *Node) Kind() Kind { return n.kind }
func (n *Node) Kind() Kind { return n.kind }
func (n *Node) TypeChecked() bool { return n.flags&FlagsTypeChecked != 0 }
func (n *Node) SetTypeChecked() { n.flags |= FlagsTypeChecked }
func (n *Node) Assert() *Assert { return (*Assert)(n) }
func (n *Node) Assign() *Assign { return (*Assign)(n) }
@@ -150,6 +153,9 @@ func (n *Raw) List1() []*Node { return n.list1 }
func (n *Raw) SetFilenameLine(f string, l uint32) { n.filename, n.line = f, l }
// MaxExprDepth is an advisory limit for an Expr's recursion depth.
const MaxExprDepth = 255
// Expr is an expression, such as "i", "+j" or "k + l[m(n, o)].p":
// - FlagsSuspendible is "f(x)" vs "f?(x)"
// - ID0: <0|operator|IDOpenParen|IDOpenBracket|IDColon|IDDot>
@@ -351,6 +357,9 @@ func NewJump(keyword 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"
// or "[8] T":
// - ID0: <0|package name|IDPtr|IDOpenBracket>