Add positional_count field to Lambda
This field is used for static optimization, determining if parameters are purely positional.
This commit is contained in:
+9
-4
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user