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

Method argument_list

aiscript-vm/src/parser/mod.rs:1721–1754  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

1719 }
1720
1721 fn argument_list(&mut self) -> Option<(Vec<Expr<'gc>>, HashMap<String, Expr<'gc>>)> {
1722 let mut arguments = Vec::new();
1723 let mut keyword_args = HashMap::new();
1724
1725 if !self.check(TokenType::CloseParen) {
1726 loop {
1727 if self.check(TokenType::Identifier)
1728 && matches!(self.peek_next(), Some(t) if t.kind == TokenType::Equal)
1729 {
1730 self.advance();
1731 let name = self.previous;
1732 self.advance(); // consume '='
1733 let value = self.expression()?;
1734 keyword_args.insert(name.lexeme.to_string(), value);
1735 } else {
1736 if !keyword_args.is_empty() {
1737 self.error("Positional arguments must come before keyword arguments.");
1738 }
1739 arguments.push(self.expression()?);
1740 }
1741
1742 if arguments.len() + keyword_args.len() > 255 {
1743 self.error("Can't have more than 255 arguments.");
1744 break;
1745 }
1746
1747 if !self.match_token(TokenType::Comma) {
1748 break;
1749 }
1750 }
1751 }
1752
1753 Some((arguments, keyword_args))
1754 }
1755
1756 fn bracket(&mut self, _can_assign: bool) -> Option<Expr<'gc>> {
1757 let mut elements = Vec::new();

Callers 4

pipe_arrowMethod · 0.80
callMethod · 0.80
dotMethod · 0.80
super_Method · 0.80

Calls 7

checkMethod · 0.80
advanceMethod · 0.80
expressionMethod · 0.80
pushMethod · 0.80
lenMethod · 0.80
match_tokenMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected