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

Method dot

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

Source from the content-addressed store, hash-verified

1840 }
1841
1842 fn dot(&mut self, can_assign: bool) -> Option<Expr<'gc>> {
1843 self.consume(TokenType::Identifier, "Expect property name after '.'.");
1844 let name = self.previous;
1845 let object = Box::new(self.previous_expr.take()?);
1846
1847 if can_assign && self.match_token(TokenType::Equal) {
1848 let value = Box::new(self.expression()?);
1849 Some(Expr::Set {
1850 object,
1851 name,
1852 value,
1853 line: self.previous.line,
1854 })
1855 } else if self.match_token(TokenType::OpenParen) {
1856 let (arguments, keyword_args) = self.argument_list()?;
1857 self.consume(TokenType::CloseParen, "Expect ')' after arguments.");
1858
1859 Some(Expr::Invoke {
1860 object,
1861 method: name,
1862 arguments,
1863 keyword_args,
1864 error_handler: self.parse_error_handling(),
1865 line: self.previous.line,
1866 })
1867 } else {
1868 Some(Expr::Get {
1869 object,
1870 name,
1871 line: self.previous.line,
1872 })
1873 }
1874 }
1875
1876 fn match_compound_assignment(&mut self) -> Option<TokenType> {
1877 let kind = match self.current.kind {

Callers

nothing calls this directly

Calls 5

match_tokenMethod · 0.80
expressionMethod · 0.80
argument_listMethod · 0.80
parse_error_handlingMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected