mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Remove ptr base.u8 methods
This commit is contained in:
1 parent
96a549814d
commit
1435f1d43c
5 files changed
+4
-43
No files matched your search
@@ -669,8 +669,6 @@ const MaxTypeExprDepth = 63
|
||||
// type. LHS is the receiver type, which may be nil. If non-nil, it will be a
|
||||
// pointee type: "T" instead of "ptr T", "ptr ptr T", etc.
|
||||
//
|
||||
// TODO: is "pointee type" correct for the built-in ptr base.u8 methods??
|
||||
//
|
||||
// TODO: method effects: "foo" vs "foo!" vs "foo?".
|
||||
//
|
||||
// A zero ID0 means a (possibly package-qualified) type like "pkg.foo" or
|
||||
|
||||
@@ -134,21 +134,16 @@ var Funcs = []string{
|
||||
"image_config.initialize!(pixfmt u32, pixsub u32, width u32, height u32, num_loops u32)()",
|
||||
}
|
||||
|
||||
// The "T" types here are placeholders for "ptr base.u8" or generic "slice U"
|
||||
// types. After tokenizing (but before parsing) these XxxFunc strings (e.g. in
|
||||
// the lang/check package), replace the "T" receiver type with the "◊" diamond,
|
||||
// to avoid collision with a user-defined "T" type.
|
||||
// The "T" types here are placeholders for generic "slice U" types. After
|
||||
// tokenizing (but before parsing) these SliceFunc strings (e.g. in the
|
||||
// lang/check package), replace the "T" receiver type with the "◊" diamond, to
|
||||
// avoid collision with a user-defined "T" type.
|
||||
|
||||
const (
|
||||
PlaceholderOldName = t.IDCapitalT
|
||||
PlaceholderNewName = t.IDDiamond
|
||||
)
|
||||
|
||||
// TODO: drop the U8.
|
||||
var PtrU8Funcs = []string{
|
||||
// TODO: a length method.
|
||||
}
|
||||
|
||||
var SliceFuncs = []string{
|
||||
"T.copy_from_slice(s T)(ret u64)",
|
||||
"T.length()(ret u64)",
|
||||
|
||||
@@ -160,7 +160,6 @@ type Checker struct {
|
||||
useBaseNames map[t.ID]struct{}
|
||||
|
||||
builtInFuncs map[t.QQID]*a.Func
|
||||
builtInPtrU8Funcs map[t.QQID]*a.Func
|
||||
builtInSliceFuncs map[t.QQID]*a.Func
|
||||
unsortedStructs []*a.Struct
|
||||
}
|
||||
|
||||
@@ -80,17 +80,6 @@ func (c *Checker) builtInFunc(qqid t.QQID) (*a.Func, error) {
|
||||
return c.builtInFuncs[qqid], nil
|
||||
}
|
||||
|
||||
func (c *Checker) builtInPtrU8Func(qqid t.QQID) (*a.Func, error) {
|
||||
if c.builtInPtrU8Funcs == nil {
|
||||
err := error(nil)
|
||||
c.builtInPtrU8Funcs, err = parseBuiltInFuncs(c.tm, builtin.PtrU8Funcs, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return c.builtInPtrU8Funcs[qqid], nil
|
||||
}
|
||||
|
||||
func (c *Checker) builtInSliceFunc(qqid t.QQID) (*a.Func, error) {
|
||||
if c.builtInSliceFuncs == nil {
|
||||
err := error(nil)
|
||||
@@ -158,15 +147,6 @@ func (c *Checker) resolveFunc(typ *a.TypeExpr) (*a.Func, error) {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
} else if lTyp.Decorator() == t.IDPtr && (lTyp.Inner().QID() == t.QID{t.IDBase, t.IDU8}) {
|
||||
qqid[0] = t.IDBase
|
||||
qqid[1] = t.IDDiamond
|
||||
if f, err := c.builtInPtrU8Func(qqid); err != nil {
|
||||
return nil, err
|
||||
} else if f != nil {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
} else {
|
||||
if f, err := c.builtInFunc(qqid); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -658,17 +658,6 @@ func (q *checker) tcheckDot(n *a.Expr, depth uint32) error {
|
||||
n.SetMType(a.NewTypeExpr(t.IDFunc, 0, n.Ident(), lTyp.Node(), nil, nil))
|
||||
return nil
|
||||
|
||||
} else if ptrLTyp := lhs.MType(); ptrLTyp.Decorator() == t.IDPtr && (lQID == t.QID{t.IDBase, t.IDU8}) {
|
||||
qqid[0] = t.IDBase
|
||||
qqid[1] = t.IDDiamond
|
||||
if f, err := q.c.builtInPtrU8Func(qqid); err != nil {
|
||||
return err
|
||||
} else if f == nil {
|
||||
return fmt.Errorf("check: no ptr base.u8 method %q", n.Ident().Str(q.tm))
|
||||
}
|
||||
n.SetMType(a.NewTypeExpr(t.IDFunc, 0, n.Ident(), ptrLTyp.Node(), nil, nil))
|
||||
return nil
|
||||
|
||||
} else if lTyp.Decorator() != 0 {
|
||||
return fmt.Errorf("check: invalid type %q for dot-expression LHS %q", lTyp.Str(q.tm), lhs.Str(q.tm))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user