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

Function CallExpression

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

Source from the content-addressed store, hash-verified

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