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

Method raise_statement

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

Source from the content-addressed store, hash-verified

1953 }
1954
1955 fn raise_statement(&mut self) -> Option<Stmt<'gc>> {
1956 if self.fn_type.is_lambda() {
1957 self.error("Cannot raise error in lambda.");
1958 return None;
1959 }
1960 if !self.in_error_function() {
1961 self.error("Cannot use 'raise' outside of a function that declares error types.");
1962 return None;
1963 }
1964
1965 // TODO: check raise error type
1966 let error = self.expression()?;
1967 self.consume(TokenType::Semicolon, "Expect ';' after raise expression.");
1968 Some(Stmt::Raise {
1969 error,
1970 line: self.previous.line,
1971 })
1972 }
1973
1974 fn match_expression(&mut self, _can_assign: bool) -> Option<Expr<'gc>> {
1975 let line = self.previous.line;

Callers 1

statementMethod · 0.80

Calls 5

is_lambdaMethod · 0.80
in_error_functionMethod · 0.80
expressionMethod · 0.80
errorMethod · 0.45
consumeMethod · 0.45

Tested by

no test coverage detected