mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Generate a C placeholder for "in.src.read_u8?()".
This commit is contained in:
1 parent
0646f4472c
commit
1758637f89
7 files changed
+65
-8
No files matched your search
+10
-2
@@ -48,11 +48,11 @@ func (e *Error) Error() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// TypeExprFoo is an *ast.Node MType (implicit type) that means that n is a
|
||||
// boolean or a ideal numeric constant.
|
||||
// TypeExprFoo is an *ast.Node MType (implicit type).
|
||||
var (
|
||||
TypeExprBoolean = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
|
||||
TypeExprIdealNumber = a.NewTypeExpr(0, t.IDIdeal, nil, nil, nil)
|
||||
TypeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
|
||||
)
|
||||
|
||||
func numeric(n *a.TypeExpr) bool { return n == TypeExprIdealNumber || n.IsNumType() }
|
||||
@@ -349,6 +349,14 @@ func (c *Checker) checkFuncBody(node *a.Node) error {
|
||||
n.Node().SetTypeChecked()
|
||||
if err := n.Node().Walk(func(o *a.Node) error {
|
||||
if !o.TypeChecked() {
|
||||
switch o.Kind() {
|
||||
case a.KExpr:
|
||||
return fmt.Errorf("check: internal error: unchecked %s node %q",
|
||||
o.Kind(), o.Expr().String(q.idMap))
|
||||
case a.KTypeExpr:
|
||||
return fmt.Errorf("check: internal error: unchecked %s node %q",
|
||||
o.Kind(), o.TypeExpr().String(q.idMap))
|
||||
}
|
||||
return fmt.Errorf("check: internal error: unchecked %s node", o.Kind())
|
||||
}
|
||||
if o.Kind() == a.KExpr {
|
||||
|
||||
Reference in new issue
Block a user