mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Drop the unused ref and deref operators
This commit is contained in:
1 parent
97bcdded0d
commit
1c1ce9b19f
6 files changed
+6
-35
No files matched your search
@@ -499,8 +499,6 @@ var cOpNames = [...]string{
|
|||||||
t.IDXUnaryPlus: " + ",
|
t.IDXUnaryPlus: " + ",
|
||||||
t.IDXUnaryMinus: " - ",
|
t.IDXUnaryMinus: " - ",
|
||||||
t.IDXUnaryNot: " ! ",
|
t.IDXUnaryNot: " ! ",
|
||||||
t.IDXUnaryRef: " & ",
|
|
||||||
t.IDXUnaryDeref: " * ",
|
|
||||||
|
|
||||||
t.IDXBinaryPlus: " + ",
|
t.IDXBinaryPlus: " + ",
|
||||||
t.IDXBinaryMinus: " - ",
|
t.IDXBinaryMinus: " - ",
|
||||||
|
|||||||
@@ -146,8 +146,6 @@ var opStrings = [...]string{
|
|||||||
t.IDXUnaryPlus: "+",
|
t.IDXUnaryPlus: "+",
|
||||||
t.IDXUnaryMinus: "-",
|
t.IDXUnaryMinus: "-",
|
||||||
t.IDXUnaryNot: "not ",
|
t.IDXUnaryNot: "not ",
|
||||||
t.IDXUnaryRef: "ref ",
|
|
||||||
t.IDXUnaryDeref: "deref ",
|
|
||||||
|
|
||||||
t.IDXBinaryPlus: " + ",
|
t.IDXBinaryPlus: " + ",
|
||||||
t.IDXBinaryMinus: " - ",
|
t.IDXBinaryMinus: " - ",
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ var Statuses = [...]string{
|
|||||||
`"#too much data"`,
|
`"#too much data"`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: a collection of forbidden variable names like and, or, not, as, ref,
|
// TODO: a collection of forbidden variable names like and, or, not, as, false,
|
||||||
// deref, false, true, in, out, this, u8, u16, etc?
|
// true, in, out, this, u8, u16, etc?
|
||||||
|
|
||||||
var Types = []string{
|
var Types = []string{
|
||||||
// TODO: i8, i16, i32, i64.
|
// TODO: i8, i16, i32, i64.
|
||||||
|
|||||||
@@ -1321,8 +1321,6 @@ func (q *checker) bcheckExprUnaryOp(n *a.Expr, depth uint32) (bounds, error) {
|
|||||||
return bounds{neg(rb[1]), neg(rb[0])}, nil
|
return bounds{neg(rb[1]), neg(rb[0])}, nil
|
||||||
case t.IDXUnaryNot:
|
case t.IDXUnaryNot:
|
||||||
return bounds{zero, one}, nil
|
return bounds{zero, one}, nil
|
||||||
case t.IDXUnaryRef, t.IDXUnaryDeref:
|
|
||||||
return q.bcheckTypeExpr(n.MType())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bounds{}, fmt.Errorf("check: unrecognized token (0x%X) for bcheckExprUnaryOp", n.Operator())
|
return bounds{}, fmt.Errorf("check: unrecognized token (0x%X) for bcheckExprUnaryOp", n.Operator())
|
||||||
|
|||||||
@@ -659,17 +659,6 @@ func (q *checker) tcheckExprUnaryOp(n *a.Expr, depth uint32) error {
|
|||||||
}
|
}
|
||||||
n.SetMType(typeExprBool)
|
n.SetMType(typeExprBool)
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
case t.IDXUnaryRef:
|
|
||||||
// TODO.
|
|
||||||
|
|
||||||
case t.IDXUnaryDeref:
|
|
||||||
if rTyp.Decorator() != t.IDPtr { // TODO: t.IDNptr?
|
|
||||||
return fmt.Errorf("check: %q is a dereference of a non-pointer type %q",
|
|
||||||
n.Str(q.tm), rTyp.Str(q.tm))
|
|
||||||
}
|
|
||||||
n.SetMType(rTyp.Inner())
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("check: unrecognized token (0x%X) for tcheckExprUnaryOp", n.Operator())
|
return fmt.Errorf("check: unrecognized token (0x%X) for tcheckExprUnaryOp", n.Operator())
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-16
@@ -287,18 +287,12 @@ const (
|
|||||||
IDNot = ID(0x4A)
|
IDNot = ID(0x4A)
|
||||||
IDAs = ID(0x4B)
|
IDAs = ID(0x4B)
|
||||||
|
|
||||||
// TODO: are these unused? Can we drop them (and their XUnary forms)?
|
|
||||||
IDRef = ID(0x4C)
|
|
||||||
IDDeref = ID(0x4D)
|
|
||||||
|
|
||||||
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
|
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
|
||||||
// ast.Node ID-typed fields to disambiguate e.g. unary vs binary plus.
|
// ast.Node ID-typed fields to disambiguate e.g. unary vs binary plus.
|
||||||
|
|
||||||
IDXUnaryPlus = ID(0x50)
|
IDXUnaryPlus = ID(0x50)
|
||||||
IDXUnaryMinus = ID(0x51)
|
IDXUnaryMinus = ID(0x51)
|
||||||
IDXUnaryNot = ID(0x52)
|
IDXUnaryNot = ID(0x52)
|
||||||
IDXUnaryRef = ID(0x53)
|
|
||||||
IDXUnaryDeref = ID(0x54)
|
|
||||||
|
|
||||||
IDXBinaryPlus = ID(0x58)
|
IDXBinaryPlus = ID(0x58)
|
||||||
IDXBinaryMinus = ID(0x59)
|
IDXBinaryMinus = ID(0x59)
|
||||||
@@ -669,12 +663,10 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDGreaterEq: ">=",
|
IDGreaterEq: ">=",
|
||||||
IDGreaterThan: ">",
|
IDGreaterThan: ">",
|
||||||
|
|
||||||
IDAnd: "and",
|
IDAnd: "and",
|
||||||
IDOr: "or",
|
IDOr: "or",
|
||||||
IDNot: "not",
|
IDNot: "not",
|
||||||
IDAs: "as",
|
IDAs: "as",
|
||||||
IDRef: "ref",
|
|
||||||
IDDeref: "deref",
|
|
||||||
|
|
||||||
IDFunc: "func",
|
IDFunc: "func",
|
||||||
IDAssert: "assert",
|
IDAssert: "assert",
|
||||||
@@ -1050,8 +1042,6 @@ var ambiguousForms = [nBuiltInSymbolicIDs]ID{
|
|||||||
IDXUnaryPlus: IDPlus,
|
IDXUnaryPlus: IDPlus,
|
||||||
IDXUnaryMinus: IDMinus,
|
IDXUnaryMinus: IDMinus,
|
||||||
IDXUnaryNot: IDNot,
|
IDXUnaryNot: IDNot,
|
||||||
IDXUnaryRef: IDRef,
|
|
||||||
IDXUnaryDeref: IDDeref,
|
|
||||||
|
|
||||||
IDXBinaryPlus: IDPlus,
|
IDXBinaryPlus: IDPlus,
|
||||||
IDXBinaryMinus: IDMinus,
|
IDXBinaryMinus: IDMinus,
|
||||||
@@ -1117,8 +1107,6 @@ var unaryForms = [nBuiltInSymbolicIDs]ID{
|
|||||||
IDPlus: IDXUnaryPlus,
|
IDPlus: IDXUnaryPlus,
|
||||||
IDMinus: IDXUnaryMinus,
|
IDMinus: IDXUnaryMinus,
|
||||||
IDNot: IDXUnaryNot,
|
IDNot: IDXUnaryNot,
|
||||||
IDRef: IDXUnaryRef,
|
|
||||||
IDDeref: IDXUnaryDeref,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var binaryForms = [nBuiltInSymbolicIDs]ID{
|
var binaryForms = [nBuiltInSymbolicIDs]ID{
|
||||||
|
|||||||
Reference in new issue
Block a user