MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / pipe_arrow

Method pipe_arrow

aiscript-vm/src/parser/mod.rs:1012–1047  ·  view source on GitHub ↗
(&mut self, _can_assign: bool)

Source from the content-addressed store, hash-verified

1010 }
1011
1012 fn pipe_arrow(&mut self, _can_assign: bool) -> Option<Expr<'gc>> {
1013 // Save the left side of the pipe
1014 let left = Box::new(self.previous_expr.take()?);
1015
1016 // Parse the function name as an identifier
1017 self.consume(TokenType::Identifier, "Expect function name after |>.");
1018 let callee_name = self.previous;
1019 let callee = Box::new(Expr::Variable {
1020 name: callee_name,
1021 line: callee_name.line,
1022 });
1023
1024 let mut arguments = Vec::new();
1025 let mut keyword_args = HashMap::new();
1026
1027 // Check if we have explicit parentheses
1028 if self.match_token(TokenType::OpenParen) {
1029 // Parse arguments if any
1030 if !self.check(TokenType::CloseParen) {
1031 let (args, kw_args) = self.argument_list()?;
1032 arguments = args;
1033 keyword_args = kw_args;
1034 }
1035 self.consume(TokenType::CloseParen, "Expect ')' after arguments.");
1036 }
1037
1038 // Create call expression with left being first argument
1039 Some(Expr::Call {
1040 callee,
1041 is_constructor: false,
1042 arguments: std::iter::once(*left).chain(arguments).collect(),
1043 keyword_args,
1044 error_handler: self.parse_error_handling(),
1045 line: callee_name.line,
1046 })
1047 }
1048
1049 fn const_declaration(&mut self, visibility: Visibility) -> Option<Stmt<'gc>> {
1050 self.consume(TokenType::Identifier, "Expect constant name.");

Callers

nothing calls this directly

Calls 5

match_tokenMethod · 0.80
checkMethod · 0.80
argument_listMethod · 0.80
parse_error_handlingMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected