# All files / src/parser return-statement.js

100% Statements 9/9
100% Branches 0/0
100% Functions 1/1
100% Lines 9/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    28x
    28x
    28x

    28x
    161x
    161x
    161x

    161x

    161x

     // @flow
    import Syntax from "../Syntax";
    import expression from "./expression";
    import Context from "./context";

    const returnStatement = (ctx: Context) => {
      const node = ctx.startNode();
      ctx.expect(["return"]);
      const expr = expression(ctx);

      node.params.push(expr);

      return ctx.endNode(node, Syntax.ReturnStatement);
    };

    export default returnStatement;