From d1e7bdb012ff32b4b66a034046b98de94394d677 Mon Sep 17 00:00:00 2001 From: mlokr Date: Tue, 17 Sep 2024 18:07:15 +0200 Subject: [PATCH] forcing structs to always be on stack --- hblang/src/codegen.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 68189ff8..ce4b1c07 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -898,13 +898,21 @@ impl Codegen { E::Directive { name: "TypeOf", args: [expr], .. } => { Some(Value::ty(self.infer_type(expr))) } - E::Directive { name: "eca", args: [ret_ty, args @ ..], .. } => { - let ty = self.ty(ret_ty); + E::Directive { name: "eca", args, pos } => { + let Some(ty) = ctx.ty else { + self.report( + pos, + "type to return form eca is unknown, use `@as(, @eca(...))`", + ); + }; let mut parama = self.tys.parama(ty); let base = self.pool.arg_locs.len(); for arg in args { let arg = self.expr(arg)?; + if arg.ty == ty::Id::from(ty::TYPE) { + self.report(pos, "na na na nana, no passing types to ecas"); + } self.pass_arg(&arg, &mut parama); self.pool.arg_locs.push(arg.loc); } @@ -932,7 +940,7 @@ impl Codegen { let Some(ty) = ctx.ty else { self.report( expr.pos(), - "type to cast to is unknown, use `@as(, )`", + "type to cast to is unknown, use `@as(, @intcast())`", ); }; let mut val = self.expr(val)?;