diff options
| author | 2022-08-18 09:47:54 +0200 | |
|---|---|---|
| committer | 2022-08-18 09:47:54 +0200 | |
| commit | f0214ff61b5a94b9629db6f43d7a5b010bd4ffbc (patch) | |
| tree | c8517b4950bc3937e82ff49c757fb24a7364e3b0 /src/cffc.hff | |
| parent | 8c81c70b904a41b8a0d44dc418b7c39bf325c2a2 (diff) | |
fix bodyarg
Diffstat (limited to 'src/cffc.hff')
| -rw-r--r-- | src/cffc.hff | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cffc.hff b/src/cffc.hff index aad2ee4..ad6a8aa 100644 --- a/src/cffc.hff +++ b/src/cffc.hff @@ -119,11 +119,13 @@ struct Parser { curenv *Env, curloop int, loopid int, + targty *const Type, tokloc Loc, curloc Loc, eof bool, is_header bool, peekchr Option<int>, + peektok Option<Tok>, } @@ -152,6 +154,8 @@ struct Expr { BinOp struct { op TokT, lhs *Expr, rhs *Expr }, UnOp struct { op UnOp, ex *Expr }, Cond struct { test *Expr, t *Expr, f *Expr }, + Cast *Expr, + Dot struct { lhs *Expr, fld *const AggField }, Index struct { lhs *Expr, rhs *Expr }, Slice struct { lhs *Expr, begin *Expr, end *Expr }, Call struct { lhs *Expr, args [#]Expr }, @@ -200,6 +204,7 @@ struct Var { struct MacroCase { variadic bool, + bodyarg bool, params [#]*const u8, body [#]Tok, } @@ -220,6 +225,7 @@ struct Decl { Macro Macro, Ty *const Type, }, + myenv *Env, } struct DeclList { @@ -311,12 +317,8 @@ 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) - }); -} +extern fn mkslicetype(child *const Type) *const Type; + fn childtype(ty *const Type) *const Type { switch ty.u { case Ptr t; return t; @@ -326,7 +328,9 @@ fn childtype(ty *const Type) *const Type { return #null; } extern fn completetype(ty *const Type) bool; -extern fn isnumtype(ty *const Type) bool; +fn isnumtype(ty *const Type) bool { + return ty->is(:Int) or ty->is(:Flo); +} extern fn typeof2(a *const Type, b *const Type) *const Type; // env.cff |