Add positional_count field to Lambda

This field is used for static optimization, determining if parameters
are purely positional.
This commit is contained in:
Michael Schimmel
2026-02-20 14:40:56 +01:00
parent 56d6c3bbde
commit 4e812c1afb
11 changed files with 361 additions and 62 deletions
+9 -4
View File
@@ -227,17 +227,22 @@ impl<'a> Parser<'a> {
let mut elements = Vec::new();
while *self.peek() != TokenKind::RightBracket {
let next_token = self.advance()?;
let p_identity = Rc::new(NodeIdentity { location: next_token.location });
match next_token.kind {
let next_peek = self.peek();
match next_peek {
TokenKind::Identifier(name) => {
let name = name.clone();
let token = self.advance()?;
let p_identity = Rc::new(NodeIdentity { location: token.location });
elements.push(Node {
identity: p_identity,
kind: UntypedKind::Parameter(name.into()),
ty: (),
});
},
_ => return Err(format!("Expected identifier in param vector, found {:?}", next_token.kind)),
TokenKind::LeftBracket => {
elements.push(self.parse_param_vector()?);
},
_ => return Err(format!("Expected identifier or nested parameter vector, found {:?}", next_peek)),
}
}
self.expect(TokenKind::RightBracket)?;