Unexport check.TypeExprFoo variables.

This commit is contained in:
Nigel Tao committed 2017-06-10 12:16:29 +10:00
1 parent 1c62391db3
commit 321ebf8617
4 files changed
+40 -33

No files matched your search

+5 -7
View File
@@ -55,15 +55,13 @@ func trimQuotes(s string) string {
return s
}
// TypeExprFoo is an *ast.Node MType (implicit type).
// typeExprFoo is an *ast.Node MType (implicit type).
var (
TypeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
TypeExprIdeal = a.NewTypeExpr(0, t.IDDoubleZ, nil, nil, nil)
TypeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
typeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
typeExprIdeal = a.NewTypeExpr(0, t.IDDoubleZ, nil, nil, nil)
typeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
)
func numeric(n *a.TypeExpr) bool { return n == TypeExprIdeal || n.IsNumType() }
// TypeMap maps from variable names (as token IDs) to types.
type TypeMap map[t.ID]*a.TypeExpr
@@ -399,7 +397,7 @@ func (c *Checker) checkFuncBody(node *a.Node) error {
if typ := o.MType(); typ == nil {
return fmt.Errorf("check: internal error: expression %q has no (implicit) type",
o.String(q.tm))
} else if typ == TypeExprIdeal && o.ConstValue() == nil {
} else if typ.IsIdeal() && o.ConstValue() == nil {
return fmt.Errorf("check: internal error: expression %q has ideal number type "+
"but no const value", o.String(q.tm))
}