From 09fcbbc03b1379f056797e72d153920a01328268 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 68189ff..ce4b1c0 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)?;