source: imaps-frontend/node_modules/@babel/helper-optimise-call-expression/lib/index.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.0 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = optimiseCallExpression;
7var _t = require("@babel/types");
8const {
9 callExpression,
10 identifier,
11 isIdentifier,
12 isSpreadElement,
13 memberExpression,
14 optionalCallExpression,
15 optionalMemberExpression
16} = _t;
17function optimiseCallExpression(callee, thisNode, args, optional) {
18 if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, {
19 name: "arguments"
20 })) {
21 if (optional) {
22 return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false);
23 }
24 return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]);
25 } else {
26 if (optional) {
27 return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false);
28 }
29 return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]);
30 }
31}
32
33//# sourceMappingURL=index.js.map
Note: See TracBrowser for help on using the repository browser.