functionDeclaration method

AstNode functionDeclaration()

Implementation

AstNode functionDeclaration() {
  Token name = consume(TokenType.identifier, "Expect function name.");
  consume(TokenType.leftParen, "Expect '(' after function name.");
  final parameters = _parseParameterTokens();
  consume(TokenType.leftBrace, "Expect '{' before function body.");
  final body = block();
  return FunctionDeclaration(name, parameters, body);
}