@effect/language-service 0.16.5 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -12
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2887,21 +2887,31 @@ var effectGenToFn = createRefactor({
|
|
|
2887
2887
|
const parseEffectGenNode = fn("asyncAwaitToGen.apply")(function* (node) {
|
|
2888
2888
|
const effectGen2 = yield* effectGen(node);
|
|
2889
2889
|
let pipeArgs2 = ts.factory.createNodeArray([]);
|
|
2890
|
-
let nodeToReplace2 = node
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
nodeToReplace2
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
if (ts.
|
|
2897
|
-
return { ...effectGen2, pipeArgs: pipeArgs2, nodeToReplace:
|
|
2890
|
+
let nodeToReplace2 = node;
|
|
2891
|
+
while (nodeToReplace2.parent) {
|
|
2892
|
+
const parent = nodeToReplace2.parent;
|
|
2893
|
+
if (ts.isConciseBody(nodeToReplace2) && ts.isArrowFunction(parent) && parent.body === nodeToReplace2) {
|
|
2894
|
+
return { ...effectGen2, pipeArgs: pipeArgs2, nodeToReplace: parent };
|
|
2895
|
+
}
|
|
2896
|
+
if ((ts.isFunctionDeclaration(parent) || ts.isMethodDeclaration(parent)) && parent.body === nodeToReplace2) {
|
|
2897
|
+
return { ...effectGen2, pipeArgs: pipeArgs2, nodeToReplace: parent };
|
|
2898
|
+
}
|
|
2899
|
+
if (ts.isBlock(parent) && parent.statements.length === 1 && parent.statements[0] === nodeToReplace2) {
|
|
2900
|
+
nodeToReplace2 = parent;
|
|
2901
|
+
continue;
|
|
2902
|
+
}
|
|
2903
|
+
if (ts.isReturnStatement(parent) && parent.expression === nodeToReplace2) {
|
|
2904
|
+
nodeToReplace2 = parent;
|
|
2905
|
+
continue;
|
|
2898
2906
|
}
|
|
2899
|
-
if (ts.
|
|
2900
|
-
|
|
2907
|
+
if (ts.isPropertyAccessExpression(parent) && parent.expression === nodeToReplace2 && parent.name.text === "pipe" && ts.isCallExpression(parent.parent)) {
|
|
2908
|
+
pipeArgs2 = ts.factory.createNodeArray(pipeArgs2.concat(parent.parent.arguments));
|
|
2909
|
+
nodeToReplace2 = parent.parent;
|
|
2901
2910
|
continue;
|
|
2902
2911
|
}
|
|
2903
|
-
if (ts.
|
|
2904
|
-
|
|
2912
|
+
if (ts.isCallExpression(parent) && ts.isIdentifier(parent.expression) && parent.expression.text === "pipe" && parent.arguments.length > 0 && parent.arguments[0] === nodeToReplace2) {
|
|
2913
|
+
pipeArgs2 = ts.factory.createNodeArray(pipeArgs2.concat(parent.arguments.slice(1)));
|
|
2914
|
+
nodeToReplace2 = parent;
|
|
2905
2915
|
continue;
|
|
2906
2916
|
}
|
|
2907
2917
|
break;
|