parseFunctionDeclaration method

Statement parseFunctionDeclaration()

Implementation

Statement parseFunctionDeclaration() {
  int? start = token!.startOffset;
  int? line = token!.line;
  assert(token!.text == 'function');
  FunctionNode func = parseFunction();
  if (func.name == null) {
    fail(message: 'Function declaration must have a name');
  }
  return FunctionDeclaration(func)
    ..start = start
    ..end = endOffset
    ..line = line;
}