MCPcopy Create free account
hub / github.com/babel/babel / CallExpression

Function CallExpression

Gulpfile.ts:1050–1084  ·  view source on GitHub ↗
(path: NodePath<types.CallExpression>)

Source from the content-addressed store, hash-verified

1048 ({ types: t }: typeof import("@babel/core")) => ({
1049 visitor: {
1050 CallExpression(path: NodePath<types.CallExpression>) {
1051 if (path.node.arguments.length < 2) return;
1052 if (!path.parentPath.isExpressionStatement()) return;
1053
1054 let callee = path.get("callee");
1055 while (callee.isMemberExpression() || callee.isCallExpression()) {
1056 if (callee.isCallExpression()) {
1057 callee = callee.get("callee");
1058 } else {
1059 callee = callee.get("object");
1060 }
1061 }
1062 if (!callee.isIdentifier()) return;
1063 switch (callee.node.name) {
1064 case "itNoESM":
1065 case "itGteNoESM":
1066 case "itBabel7":
1067 case "itBabel7NoESM":
1068 case "itBabel7GteNoESM":
1069 case "describeBabel7":
1070 case "describeBabel7NoESM":
1071 path.remove();
1072 break;
1073
1074 case "itESM":
1075 case "itBabel8":
1076 callee.replaceWith(t.identifier("it"));
1077 break;
1078
1079 case "describeESM":
1080 case "describeBabel8":
1081 callee.replaceWith(t.identifier("describe"));
1082 break;
1083 }
1084 },
1085 Program: {
1086 exit(path: NodePath<types.Program>) {
1087 path.scope.crawl();

Callers

nothing calls this directly

Calls 6

isExpressionStatementMethod · 0.80
isMemberExpressionMethod · 0.80
isCallExpressionMethod · 0.80
isIdentifierMethod · 0.80
removeMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected