{"ScriptPreparationCode":"const data = [\u0022hello\u0022, \u0022 \u0022, \u0022world\u0022];\r\nlet cid = 0;\r\nvar dep1 = { id: 0 };\r\nvar dep2 = { id: 1 };\r\nvar dep3 = { id: 2 };\r\n\r\nfunction sampleArgs1(_0) {\r\n return _0;\r\n}\r\n\r\nfunction sampleArgs2(_0, _1) {\r\n return _0 \u002B _1;\r\n}\r\n\r\nfunction sampleArgs3(_0, _1, _2) {\r\n return _0 \u002B _1 \u002B _2;\r\n}\r\n\r\nfunction sampleDes1(_0) {\r\n return _0;\r\n}\r\n\r\nfunction sampleDes2([_0, _1]) {\r\n return _0 \u002B _1;\r\n}\r\n\r\nfunction sampleDes3([_0, _1, _2]) {\r\n return _0 \u002B _1 \u002B _2;\r\n}\r\n\r\nfunction createApplyComputation(fn, deps, isSingle) {\r\n return {\r\n id: cid\u002B\u002B,\r\n fn,\r\n deps,\r\n apply: isSingle ? 1 : deps.length\r\n };\r\n}\r\n\r\nfunction createSingleComputation(fn, deps, isSingle) {\r\n return {\r\n id: cid\u002B\u002B,\r\n fn,\r\n deps,\r\n isSingle\r\n };\r\n}\r\n\r\nfunction execApplyComputation(c) {\r\n switch (c.apply) {\r\n case 1:\r\n return c.fn(read(c.deps));\r\n case 2:\r\n return c.fn(read(c.deps[0]), read(c.deps[1]));\r\n default:\r\n return c.fn(...c.deps.map(read));\r\n }\r\n}\r\n\r\nfunction execSingleComputation(c) {\r\n if (c.isSingle) {\r\n return c.fn(read(c.deps));\r\n }\r\n\r\n return c.fn(c.deps.map(read));\r\n}\r\n\r\nfunction read(s) {\r\n return data[s.id];\r\n}","TestCases":[{"Name":"apply 1","Code":"execApplyComputation(createApplyComputation(sampleArgs1, dep1, true));","IsDeferred":false},{"Name":"single 1","Code":"execSingleComputation(createSingleComputation(sampleDes1, dep1, true));","IsDeferred":false},{"Name":"apply 2","Code":"execApplyComputation(createApplyComputation(sampleArgs2, [dep1, dep2]));","IsDeferred":false},{"Name":"single 2","Code":"execSingleComputation(createSingleComputation(sampleDes2, [dep1, dep2]));","IsDeferred":false},{"Name":"apply 3","Code":"execApplyComputation(createApplyComputation(sampleArgs3, [dep1, dep2, dep3]));","IsDeferred":false},{"Name":"single 3","Code":"execSingleComputation(createSingleComputation(sampleDes3, [dep1, dep2, dep3]));","IsDeferred":false}]}