cl-ast: Separate function *signature* from function bindings, for cl-typeck

Note: this breaks cl-typeck
This commit is contained in:
2024-04-16 20:31:23 -05:00
parent d0ed8309f4
commit 75adbd6473
5 changed files with 72 additions and 51 deletions

View File

@@ -324,7 +324,7 @@ pub mod function {
name
}
fn call(&self, env: &mut Environment, args: &[ConValue]) -> IResult<ConValue> {
let FnDecl { name: Identifier(name), args: declargs, body, rety: _ } = &*self.decl;
let FnDecl { name: Identifier(name), bind: declargs, body, sign: _ } = &*self.decl;
// Check arg mapping
if args.len() != declargs.len() {
return Err(Error::ArgNumber { want: declargs.len(), got: args.len() });
@@ -334,7 +334,7 @@ pub mod function {
};
// TODO: completely refactor data storage
let mut frame = env.frame("fn args");
for (Param { mutability: _, name: Identifier(name), ty: _ }, value) in
for (Param { mutability: _, name: Identifier(name) }, value) in
declargs.iter().zip(args)
{
frame.insert(name, Some(value.clone()));