@effect/language-service 0.16.4 → 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 +24 -14
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +2 -2
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1980,7 +1980,7 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
|
|
|
1980
1980
|
if (expectedType) {
|
|
1981
1981
|
result.push([body, expectedType, body, realType]);
|
|
1982
1982
|
}
|
|
1983
|
-
ts.forEachChild(
|
|
1983
|
+
ts.forEachChild(body, appendNodeToVisit);
|
|
1984
1984
|
continue;
|
|
1985
1985
|
} else if (ts.isArrowFunction(node) && (node.typeParameters || []).length > 0 && ts.isExpression(node.body)) {
|
|
1986
1986
|
const body = node.body;
|
|
@@ -1989,7 +1989,7 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
|
|
|
1989
1989
|
if (isSome2(expectedType)) {
|
|
1990
1990
|
result.push([body, expectedType.value, body, realType]);
|
|
1991
1991
|
}
|
|
1992
|
-
ts.forEachChild(
|
|
1992
|
+
ts.forEachChild(body, appendNodeToVisit);
|
|
1993
1993
|
continue;
|
|
1994
1994
|
} else if (ts.isSatisfiesExpression(node)) {
|
|
1995
1995
|
const expectedType = typeChecker.getTypeAtLocation(node.type);
|
|
@@ -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;
|