protospec_build/semantics/convert/expression/
call.rs

1use super::*;
2
3impl Scope {
4    pub(super) fn convert_call_expression(
5        self_: &Arc<RefCell<Scope>>,
6        expr: &ast::CallExpression,
7        _expected_type: PartialType,
8    ) -> AsgResult<CallExpression> {
9        let scope = self_.borrow();
10
11        let function = scope
12            .program
13            .borrow()
14            .functions
15            .get(&*expr.function.name)
16            .ok_or_else(|| {
17                AsgError::UnresolvedFunction(expr.function.name.clone(), expr.function.span)
18            })?
19            .clone();
20
21        let arguments = Self::convert_ffi_arguments(
22            self_,
23            &*function.name,
24            expr.span,
25            &expr.arguments[..],
26            &function.arguments[..],
27        )?;
28
29        Ok(CallExpression {
30            function,
31            arguments,
32            span: expr.span,
33        })
34    }
35}