mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Fill in a GIF image_config
This commit is contained in:
1 parent
d750ea7653
commit
7e90967717
8 files changed
+79
-35
No files matched your search
+23
-3
@@ -99,9 +99,13 @@ const (
|
||||
FlagsGlobalIdent = Flags(0x00000100)
|
||||
)
|
||||
|
||||
// flagsThatMatterForEq is the bitwise or of all flags that matter for the
|
||||
// Expr.Eq method.
|
||||
const flagsThatMatterForEq = Flags(0x0000FFFF)
|
||||
const (
|
||||
flagEffect = FlagsImpure | FlagsSuspendible
|
||||
|
||||
// flagsThatMatterForEq is the bitwise or of all flags that matter for the
|
||||
// Expr.Eq method.
|
||||
flagsThatMatterForEq = Flags(0x0000FFFF)
|
||||
)
|
||||
|
||||
// These flags are set by the bounds checker to generate optimized code.
|
||||
const (
|
||||
@@ -121,6 +125,20 @@ const (
|
||||
FlagsBoundsCheckOptimized = Flags(0x00020000)
|
||||
)
|
||||
|
||||
type Effect uint32
|
||||
|
||||
func (e Effect) String() string {
|
||||
switch e {
|
||||
case Effect(0):
|
||||
return ""
|
||||
case Effect(FlagsImpure):
|
||||
return "!"
|
||||
case Effect(FlagsImpure | FlagsSuspendible):
|
||||
return "?"
|
||||
}
|
||||
return "INVALID_EFFECT"
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
kind Kind
|
||||
flags Flags
|
||||
@@ -303,6 +321,7 @@ const MaxExprDepth = 255
|
||||
type Expr Node
|
||||
|
||||
func (n *Expr) Node() *Node { return (*Node)(n) }
|
||||
func (n *Expr) Effect() Effect { return Effect(n.flags & flagEffect) }
|
||||
func (n *Expr) Pure() bool { return n.flags&FlagsImpure == 0 }
|
||||
func (n *Expr) Impure() bool { return n.flags&FlagsImpure != 0 }
|
||||
func (n *Expr) Suspendible() bool { return n.flags&FlagsSuspendible != 0 }
|
||||
@@ -733,6 +752,7 @@ const MaxBodyDepth = 255
|
||||
type Func Node
|
||||
|
||||
func (n *Func) Node() *Node { return (*Node)(n) }
|
||||
func (n *Func) Effect() Effect { return Effect(n.flags & flagEffect) }
|
||||
func (n *Func) Pure() bool { return n.flags&FlagsImpure == 0 }
|
||||
func (n *Func) Impure() bool { return n.flags&FlagsImpure != 0 }
|
||||
func (n *Func) Suspendible() bool { return n.flags&FlagsSuspendible != 0 }
|
||||
|
||||
@@ -127,6 +127,8 @@ var Funcs = []string{
|
||||
"writer1.limit(l u64)(ret writer1)",
|
||||
"writer1.mark()()",
|
||||
"writer1.since_mark()(ret[] u8)",
|
||||
|
||||
"image_config.initialize!(width u32, height u32, color_model u32)()",
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -564,6 +564,10 @@ func (q *checker) tcheckExprCall(n *a.Expr, depth uint32) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ne, fe := n.Effect(), f.Effect(); ne != fe {
|
||||
return fmt.Errorf("check: %q has effect %q but %q has effect %q",
|
||||
n.Str(q.tm), ne, f.QQID().Str(q.tm), fe)
|
||||
}
|
||||
|
||||
genericType := (*a.TypeExpr)(nil)
|
||||
if f.Receiver() == (t.QID{0, t.IDDiamond}) {
|
||||
|
||||
Reference in new issue
Block a user