MCPcopy Create free account
hub / github.com/PRQL/prql / expr_of_func

Function expr_of_func

prqlc/prqlc/src/semantic/resolver/functions.rs:481–502  ·  view source on GitHub ↗
(func: Box<Func>, span: Option<Span>)

Source from the content-addressed store, hash-verified

479}
480
481pub fn expr_of_func(func: Box<Func>, span: Option<Span>) -> Box<Expr> {
482 let ty = TyFunc {
483 params: func
484 .params
485 .iter()
486 .skip(func.args.len())
487 .map(|a| a.ty.clone())
488 .collect(),
489 return_ty: func
490 .return_ty
491 .clone()
492 .or_else(|| func.clone().body.ty)
493 .map(Box::new),
494 name_hint: func.name_hint.clone(),
495 };
496
497 Box::new(Expr {
498 ty: Some(Ty::new(ty)),
499 span,
500 ..Expr::new(ExprKind::Func(func))
501 })
502}

Callers 2

fold_functionMethod · 0.85

Calls 6

mapMethod · 0.80
skipMethod · 0.80
iterMethod · 0.80
lenMethod · 0.80
FuncClass · 0.50
collectMethod · 0.45

Tested by

no test coverage detected