Signed-off-by: laibo102 <laibo2@huawei.com>
Change-Id: Ibe0f41d61dc80662f37c8c96e7f8e2ecf1704a89
This commit is contained in:
laibo102
2022-03-01 14:20:40 +08:00
parent d32462facc
commit b72ca7169a
+11 -10
View File
@@ -623,14 +623,13 @@ function processDragStartBuilder(node: ts.CallExpression): ts.CallExpression {
for (let i = 0; i < node.arguments[0].body.statements.length; i++) { for (let i = 0; i < node.arguments[0].body.statements.length; i++) {
// @ts-ignore // @ts-ignore
let statement: ts.Statement = node.arguments[0].body.statements[i]; let statement: ts.Statement = node.arguments[0].body.statements[i];
checkStatement(statement); newStatements.push(checkStatement(statement));
newStatements.push(statement);
node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction(
// @ts-ignore
node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type,
// @ts-ignore
node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]);
} }
node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction(
// @ts-ignore
node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type,
// @ts-ignore
node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]);
} }
return node; return node;
} }
@@ -640,7 +639,7 @@ function isNodeFunction(node: ts.CallExpression): boolean {
ts.isBlock(node.arguments[0].body); ts.isBlock(node.arguments[0].body);
} }
function checkStatement(statement: ts.Statement): void { function checkStatement(statement: ts.Statement): ts.Statement {
if (ts.isReturnStatement(statement)) { if (ts.isReturnStatement(statement)) {
if (ts.isObjectLiteralExpression(statement.expression)) { if (ts.isObjectLiteralExpression(statement.expression)) {
const newProperties: ts.ObjectLiteralElementLike[] = []; const newProperties: ts.ObjectLiteralElementLike[] = [];
@@ -649,10 +648,12 @@ function checkStatement(statement: ts.Statement): void {
checkProperty(property); checkProperty(property);
newProperties.push(property); newProperties.push(property);
} }
statement = ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties)); return ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties));
} else { } else {
statement = ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression)); return ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression));
} }
} else {
return statement;
} }
} }