returnStatement method

AstNode returnStatement()

Implementation

AstNode returnStatement() {
  Token keyword = previous();
  AstNode? value = !check(TokenType.semicolon) ? expression() : null;
  consume(TokenType.semicolon, "Expect ';' after return value.");
  return ReturnStatement(keyword, value);
}