MCPcopy Create free account
hub / github.com/borgo-lang/borgo / expr_lambda

Method expr_lambda

compiler/src/parser.rs:574–607  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

572 }
573
574 fn expr_lambda(&mut self) -> Expr {
575 assert!(self.tok.kind == TokenKind::Pipe || self.tok.kind == TokenKind::Pipe2);
576
577 let start = self.start();
578
579 let args = if self.tok.kind == TokenKind::Pipe {
580 self.parse_param_list(ParamsMode::Lambda)
581 } else {
582 // if token is '||' we already know there are no params
583 self.next();
584 vec![]
585 };
586
587 let kind = FunctionKind::Lambda;
588 let ann = self.parse_ret_type(kind);
589 let body = self.parse_expr();
590
591 let fun = Function {
592 name: "__anonymous".into(),
593 args,
594 ann,
595 generics: vec![],
596 body: body.into(),
597 ret: Type::dummy(),
598 bounded_ty: Type::dummy().to_bounded(),
599 };
600
601 Expr::Closure {
602 fun,
603 kind,
604 ty: Type::dummy(),
605 span: self.make_span(start),
606 }
607 }
608
609 fn expr_multi_string(&mut self) -> Expr {
610 assert!(self.tok.kind == TokenKind::MultiString);

Callers 1

primary_exprMethod · 0.80

Calls 7

parse_param_listMethod · 0.80
parse_ret_typeMethod · 0.80
parse_exprMethod · 0.80
to_boundedMethod · 0.80
make_spanMethod · 0.80
startMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected