Rename buf1, reader1, etc to io_buffer, io_reader

Also remove the unused Buf1, Buf2 and Usize tokens.
This commit is contained in:
Nigel Tao committed 2018-04-05 20:49:48 +10:00
1 parent 82a48796c8
commit 97aab37462
46 files changed
+823 -847

No files matched your search

+12 -13
View File
@@ -23,16 +23,15 @@ import (
)
var numTypeBounds = [256][2]*big.Int{
t.KeyI8: {big.NewInt(-1 << 7), big.NewInt(1<<7 - 1)},
t.KeyI16: {big.NewInt(-1 << 15), big.NewInt(1<<15 - 1)},
t.KeyI32: {big.NewInt(-1 << 31), big.NewInt(1<<31 - 1)},
t.KeyI64: {big.NewInt(-1 << 63), big.NewInt(1<<63 - 1)},
t.KeyU8: {zero, big.NewInt(0).SetUint64(1<<8 - 1)},
t.KeyU16: {zero, big.NewInt(0).SetUint64(1<<16 - 1)},
t.KeyU32: {zero, big.NewInt(0).SetUint64(1<<32 - 1)},
t.KeyU64: {zero, big.NewInt(0).SetUint64(1<<64 - 1)},
t.KeyUsize: {zero, zero},
t.KeyBool: {zero, one},
t.KeyI8: {big.NewInt(-1 << 7), big.NewInt(1<<7 - 1)},
t.KeyI16: {big.NewInt(-1 << 15), big.NewInt(1<<15 - 1)},
t.KeyI32: {big.NewInt(-1 << 31), big.NewInt(1<<31 - 1)},
t.KeyI64: {big.NewInt(-1 << 63), big.NewInt(1<<63 - 1)},
t.KeyU8: {zero, big.NewInt(0).SetUint64(1<<8 - 1)},
t.KeyU16: {zero, big.NewInt(0).SetUint64(1<<16 - 1)},
t.KeyU32: {zero, big.NewInt(0).SetUint64(1<<32 - 1)},
t.KeyU64: {zero, big.NewInt(0).SetUint64(1<<64 - 1)},
t.KeyBool: {zero, one},
}
var (
@@ -1192,11 +1191,11 @@ func (q *checker) bcheckTypeExpr(typ *a.TypeExpr) (*big.Int, *big.Int, error) {
return nil, nil, nil
}
// TODO: is the special cases for reader1 and writer1 superfluous with the
// general purpose code for built-ins below?
// TODO: is the special cases for io_reader and io_writer superfluous with
// the general purpose code for built-ins below?
if qid := typ.QID(); qid[0] == 0 {
switch qid[1].Key() {
case t.KeyReader1, t.KeyWriter1:
case t.KeyIOReader, t.KeyIOWriter:
return nil, nil, nil
}
}
+2 -2
View File
@@ -60,7 +60,7 @@ func (q *checker) optimizeNonSuspendible(n *a.Expr) error {
return nil
}
// TODO: check that nReceiver's type is actually a reader1 or writer1.
// TODO: check that nReceiver's type is actually a io_reader or io_writer.
switch nMethod {
case t.KeyCopyFromHistory32:
@@ -225,7 +225,7 @@ func (q *checker) optimizeSuspendible(n *a.Expr, depth uint32) error {
return nil
}
// TODO: check that nReceiver's type is actually a reader1 or writer1.
// TODO: check that nReceiver's type is actually a io_reader or io_writer.
if nMethod == t.KeyUnreadU8 {
// unread_u8 can never suspend, only succeed or fail.
+4 -4
View File
@@ -44,8 +44,8 @@ var (
typeExprU64 = a.NewTypeExpr(0, 0, t.IDU64, nil, nil, nil)
typeExprBool = a.NewTypeExpr(0, 0, t.IDBool, nil, nil, nil)
typeExprStatus = a.NewTypeExpr(0, 0, t.IDStatus, nil, nil, nil)
typeExprReader1 = a.NewTypeExpr(0, 0, t.IDReader1, nil, nil, nil)
typeExprWriter1 = a.NewTypeExpr(0, 0, t.IDWriter1, nil, nil, nil)
typeExprIOReader = a.NewTypeExpr(0, 0, t.IDIOReader, nil, nil, nil)
typeExprIOWriter = a.NewTypeExpr(0, 0, t.IDIOWriter, nil, nil, nil)
typeExprImageConfig = a.NewTypeExpr(0, 0, t.IDImageConfig, nil, nil, nil)
typeExprSliceU8 = a.NewTypeExpr(t.IDColon, 0, 0, nil, nil, typeExprU8)
@@ -66,8 +66,8 @@ var builtInTypeMap = typeMap{
t.IDU64: typeExprU64,
t.IDBool: typeExprBool,
t.IDStatus: typeExprStatus,
t.IDReader1: typeExprReader1,
t.IDWriter1: typeExprWriter1,
t.IDIOReader: typeExprIOReader,
t.IDIOWriter: typeExprIOWriter,
t.IDImageConfig: typeExprImageConfig,
}