From c50a02ec703c7c1c5f6823c8cbd07a424d604792 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 17 Aug 2022 05:18:22 +0200 Subject: more exprs, warnings --- src/cffc.hff | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/cffc.hff') diff --git a/src/cffc.hff b/src/cffc.hff index 8cdf655..ff9d3eb 100644 --- a/src/cffc.hff +++ b/src/cffc.hff @@ -120,7 +120,11 @@ struct Expr { BinOp struct { op TokT, lhs *Expr, rhs *Expr }, UnOp struct { op UnOp, ex *Expr }, Cond struct { test *Expr, t *Expr, f *Expr }, - Call struct { lhs *Expr, args [#]Expr } + Index struct { lhs *Expr, rhs *Expr }, + Slice struct { lhs *Expr, begin *Expr, end *Expr }, + Call struct { lhs *Expr, args [#]Expr }, + ZeroIni, + Ini struct { }, } } @@ -188,6 +192,7 @@ extern fn pfmt(proc *fn(u8, *void) void, parg *void, fmt *const u8, ...) void; extern fn vefmt(fmt *const u8, ap va_list) void; extern fn efmt(fmt *const u8, ...) void; extern fn ssfmt(fmt *const u8, ...) *const u8; +extern fn warn(P *Parser, Loc, fmt *const u8, ...) void; extern fn err(P *Parser, Loc, fmt *const u8, ...) void; extern fn fatal(*Parser, Loc, fmt *const u8, ...) void; @@ -246,6 +251,21 @@ fn mkptrtype(child *const Type) *const Type { .u: :Ptr(child) }); } +fn mkslicetype(child *const Type) *const Type { + return interntype({ + g_targ.ptrsize, + .u: :Ptr(child) + }); +} +fn childtype(ty *const Type) *const Type { + switch ty.u { + case Ptr t; return t; + case Arr a; return a.child; + case Slice t; return t; + } + return #null; +} +extern fn completetype(ty *const Type) bool; extern fn isnumtype(ty *const Type) bool; extern fn typeof2(a *const Type, b *const Type) *const Type; -- cgit v1.2.3