ifStatement method
Implementation
AstNode ifStatement() {
consume(TokenType.leftParen, "Expect '(' after 'if'.");
AstNode condition = expression();
consume(TokenType.rightParen, "Expect ')' after if condition.");
AstNode thenBranch = statement();
AstNode? elseBranch;
if (match([TokenType.tartElse])) {
elseBranch = statement();
}
return IfStatement(condition, thenBranch, elseBranch);
}