forcing structs to always be on stack

This commit is contained in:
mlokr 2024-09-17 18:07:15 +02:00
parent a7fda408ef
commit 09fcbbc03b
No known key found for this signature in database
GPG key ID: DEA147DDEE644993

View file

@ -898,13 +898,21 @@ impl Codegen {
E::Directive { name: "TypeOf", args: [expr], .. } => { E::Directive { name: "TypeOf", args: [expr], .. } => {
Some(Value::ty(self.infer_type(expr))) Some(Value::ty(self.infer_type(expr)))
} }
E::Directive { name: "eca", args: [ret_ty, args @ ..], .. } => { E::Directive { name: "eca", args, pos } => {
let ty = self.ty(ret_ty); let Some(ty) = ctx.ty else {
self.report(
pos,
"type to return form eca is unknown, use `@as(<type>, @eca(...<expr>))`",
);
};
let mut parama = self.tys.parama(ty); let mut parama = self.tys.parama(ty);
let base = self.pool.arg_locs.len(); let base = self.pool.arg_locs.len();
for arg in args { for arg in args {
let arg = self.expr(arg)?; 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.pass_arg(&arg, &mut parama);
self.pool.arg_locs.push(arg.loc); self.pool.arg_locs.push(arg.loc);
} }
@ -932,7 +940,7 @@ impl Codegen {
let Some(ty) = ctx.ty else { let Some(ty) = ctx.ty else {
self.report( self.report(
expr.pos(), expr.pos(),
"type to cast to is unknown, use `@as(<type>, <expr>)`", "type to cast to is unknown, use `@as(<type>, @intcast(<expr>))`",
); );
}; };
let mut val = self.expr(val)?; let mut val = self.expr(val)?;