parseReturn method

Statement parseReturn()

Implementation

Statement parseReturn() {
  int? start = token!.startOffset;
  int? line = token!.line;
  assert(token!.text == 'return');
  consume(Token.NAME);
  Expression? exp;
  if (token!.type != Token.SEMICOLON &&
      token!.type != Token.RBRACE &&
      token!.type != Token.EOF &&
      !token!.afterLinebreak!) {
    exp = parseExpression();
  }
  consumeSemicolon();
  return ReturnStatement(exp)
    ..start = start
    ..end = endOffset
    ..line = line;
}