# All files / src/parser memory-store.js

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    28x
    28x
    28x

    28x

    22x

    22x

    22x

    22x

     // @flow
    import invariant from "invariant";
    import Syntax from "../Syntax";
    import expression from "./expression";
    import type Context from "./context";
    import type { NodeType } from "../flow/types";

    // Parse the expression and set the appropriate Type for the generator
    const memoryStore = (ctx: Context): NodeType => {
      // Parse the assignment
      const node = expression(ctx);

      invariant(
        node.params.length > 0,
        "Memory Store expression could not be parsed"
      );

      const type = node.params[0].type;

      return ctx.endNode({ ...node, type }, Syntax.MemoryAssignment);
    };

    export default memoryStore;