parseFunction method

FunctionNode parseFunction()

Implementation

FunctionNode parseFunction() {
  int? start = token!.startOffset;
  assert(token!.text == 'function');
  Token funToken = next();
  Name? name;
  if (token!.type == Token.NAME) {
    name = parseName();
  }
  List<Name> params = parseParameters();
  BlockStatement body = parseFunctionBody();
  return FunctionNode(name, params, body)
    ..start = start
    ..end = endOffset
    ..line = funToken.line;
}