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

Method while_statement

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

Source from the content-addressed store, hash-verified

1091 }
1092
1093 fn while_statement(&mut self) -> Option<Stmt<'gc>> {
1094 // Set flag before parsing condition
1095 self.stop_at_brace = true;
1096 let condition = self.expression()?;
1097 self.stop_at_brace = false;
1098
1099 self.consume(TokenType::OpenBrace, "Expect '{' before loop body.");
1100 self.loop_depth += 1;
1101 let body = Box::new(self.block_statement()?);
1102 self.loop_depth -= 1;
1103
1104 Some(Stmt::Loop {
1105 initializer: None,
1106 condition,
1107 body,
1108 increment: None,
1109 line: self.previous.line,
1110 })
1111 }
1112
1113 fn for_statement(&mut self) -> Option<Stmt<'gc>> {
1114 let initializer = if self.match_token(TokenType::Semicolon) {

Callers 1

statementMethod · 0.80

Calls 3

expressionMethod · 0.80
block_statementMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected