Decode flate code length code lengths.

This commit is contained in:
Nigel Tao committed 2017-07-16 12:51:44 +10:00
1 parent b78807d60a
commit 20f37a6dab
8 files changed
+95 -15

No files matched your search

+3
View File
@@ -82,6 +82,7 @@ const (
FlagsTypeChecked = Flags(0x00000020)
FlagsHasBreak = Flags(0x00000040)
FlagsHasContinue = Flags(0x00000080)
FlagsGlobalIdent = Flags(0x00000100)
)
type Node struct {
@@ -217,6 +218,7 @@ func (n *Expr) Impure() bool { return n.flags&FlagsImpure != 0 }
func (n *Expr) Suspendible() bool { return n.flags&FlagsSuspendible != 0 }
func (n *Expr) CallImpure() bool { return n.flags&FlagsCallImpure != 0 }
func (n *Expr) CallSuspendible() bool { return n.flags&FlagsCallSuspendible != 0 }
func (n *Expr) GlobalIdent() bool { return n.flags&FlagsGlobalIdent != 0 }
func (n *Expr) ConstValue() *big.Int { return n.constValue }
func (n *Expr) MType() *TypeExpr { return n.mType }
func (n *Expr) ID0() t.ID { return n.id0 }
@@ -228,6 +230,7 @@ func (n *Expr) Args() []*Node { return n.list0 }
func (n *Expr) SetConstValue(x *big.Int) { n.constValue = x }
func (n *Expr) SetMType(x *TypeExpr) { n.mType = x }
func (n *Expr) SetGlobalIdent() { n.flags |= FlagsGlobalIdent }
func NewExpr(flags Flags, operator t.ID, nameLiteralSelector t.ID, lhs *Node, mhs *Node, rhs *Node, args []*Node) *Expr {
if lhs != nil {
+8 -1
View File
@@ -312,7 +312,14 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
return nil
}
}
// TODO: look for (global) names (constants, funcs, structs).
if c, ok := q.c.consts[id1]; ok {
// TODO: check somewhere that a global ident (i.e. a const) is
// not directly in the LHS of an assignment.
n.SetGlobalIdent()
n.SetMType(c.Const.XType())
return nil
}
// TODO: look for other (global) names: funcs, structs.
return fmt.Errorf("check: unrecognized identifier %q", id1.String(q.tm))
}
switch id1.Key() {