(
context: &mut ParserContext,
env: &mut Environment,
tokens: &[Token],
position: &mut usize,
)
| 14 | use crate::token::TokenKind; |
| 15 | |
| 16 | pub(crate) fn parse_cast_operator_expression( |
| 17 | context: &mut ParserContext, |
| 18 | env: &mut Environment, |
| 19 | tokens: &[Token], |
| 20 | position: &mut usize, |
| 21 | ) -> Result<Box<dyn Expr>, Box<Diagnostic>> { |
| 22 | let expr = parse_index_or_slice_expression(context, env, tokens, position)?; |
| 23 | if *position < tokens.len() && tokens[*position].kind == TokenKind::ColonColon { |
| 24 | // Consume `::` Token |
| 25 | let colon_colon_token = &tokens[*position]; |
| 26 | *position += 1; |
| 27 | |
| 28 | let target_type = parse_type(env, tokens, position)?; |
| 29 | return cast_expression_or_error(expr, target_type, colon_colon_token.location); |
| 30 | } |
| 31 | Ok(expr) |
| 32 | } |
| 33 | |
| 34 | pub(crate) fn parse_cast_call_expression( |
| 35 | context: &mut ParserContext, |
no test coverage detected
searching dependent graphs…