diff --git a/lib/tsc.js b/lib/tsc.js index db724b82a06d1..0be45fbb402e8 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -73480,6 +73480,8 @@ var ts; switch (node.kind) { case 213: return visitBinaryExpression(node); + case 332: + return visitCommaListExpression(node); case 214: return visitConditionalExpression(node); case 216: @@ -73671,20 +73673,6 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitLogicalBinaryExpression(node) { - var resultLabel = defineLabel(); - var resultLocal = declareLocal(); - emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left); - if (node.operatorToken.kind === 55) { - emitBreakWhenFalse(resultLabel, resultLocal, node.left); - } - else { - emitBreakWhenTrue(resultLabel, resultLocal, node.left); - } - emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right); - markLabel(resultLabel); - return resultLocal; - } function visitCommaExpression(node) { var pendingExpressions = []; visit(node.left); @@ -73704,6 +73692,37 @@ var ts; } } } + function visitCommaListExpression(node) { + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } + function visitLogicalBinaryExpression(node) { + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left); + if (node.operatorToken.kind === 55) { + emitBreakWhenFalse(resultLabel, resultLocal, node.left); + } + else { + emitBreakWhenTrue(resultLabel, resultLocal, node.left); + } + emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right); + markLabel(resultLabel); + return resultLocal; + } function visitConditionalExpression(node) { if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) { var whenFalseLabel = defineLabel(); diff --git a/lib/tsserver.js b/lib/tsserver.js index 32a10af2f09c6..e014ab866df18 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -89418,6 +89418,8 @@ var ts; switch (node.kind) { case 213 /* BinaryExpression */: return visitBinaryExpression(node); + case 332 /* CommaListExpression */: + return visitCommaListExpression(node); case 214 /* ConditionalExpression */: return visitConditionalExpression(node); case 216 /* YieldExpression */: @@ -89712,6 +89714,61 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node) { + // flattened version of `visitCommaExpression` + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } /** * Visits a logical binary expression containing `yield`. * @@ -89761,38 +89818,6 @@ var ts; markLabel(resultLabel); return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - var pendingExpressions = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - function visit(node) { - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); - } - } - } /** * Visits a conditional expression containing `yield`. * diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 17b595a94c88a..80400bcfcf50d 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -89612,6 +89612,8 @@ var ts; switch (node.kind) { case 213 /* BinaryExpression */: return visitBinaryExpression(node); + case 332 /* CommaListExpression */: + return visitCommaListExpression(node); case 214 /* ConditionalExpression */: return visitConditionalExpression(node); case 216 /* YieldExpression */: @@ -89906,6 +89908,61 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node) { + // flattened version of `visitCommaExpression` + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } /** * Visits a logical binary expression containing `yield`. * @@ -89955,38 +90012,6 @@ var ts; markLabel(resultLabel); return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - var pendingExpressions = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - function visit(node) { - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); - } - } - } /** * Visits a conditional expression containing `yield`. * diff --git a/lib/typescript.js b/lib/typescript.js index 5c6f7acec7369..4ee574ace19bc 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -89612,6 +89612,8 @@ var ts; switch (node.kind) { case 213 /* BinaryExpression */: return visitBinaryExpression(node); + case 332 /* CommaListExpression */: + return visitCommaListExpression(node); case 214 /* ConditionalExpression */: return visitConditionalExpression(node); case 216 /* YieldExpression */: @@ -89906,6 +89908,61 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node) { + // flattened version of `visitCommaExpression` + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } /** * Visits a logical binary expression containing `yield`. * @@ -89955,38 +90012,6 @@ var ts; markLabel(resultLabel); return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - var pendingExpressions = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - function visit(node) { - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); - } - } - } /** * Visits a conditional expression containing `yield`. * diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 1c648a1d818dd..28b0913ceed6e 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -89612,6 +89612,8 @@ var ts; switch (node.kind) { case 213 /* BinaryExpression */: return visitBinaryExpression(node); + case 332 /* CommaListExpression */: + return visitCommaListExpression(node); case 214 /* ConditionalExpression */: return visitConditionalExpression(node); case 216 /* YieldExpression */: @@ -89906,6 +89908,61 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node) { + // flattened version of `visitCommaExpression` + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } /** * Visits a logical binary expression containing `yield`. * @@ -89955,38 +90012,6 @@ var ts; markLabel(resultLabel); return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - var pendingExpressions = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - function visit(node) { - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); - } - } - } /** * Visits a conditional expression containing `yield`. * diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 8928f295fe7d7..70499f3f16c4f 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -89407,6 +89407,8 @@ var ts; switch (node.kind) { case 213 /* BinaryExpression */: return visitBinaryExpression(node); + case 332 /* CommaListExpression */: + return visitCommaListExpression(node); case 214 /* ConditionalExpression */: return visitConditionalExpression(node); case 216 /* YieldExpression */: @@ -89701,6 +89703,61 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node) { + // flattened version of `visitCommaExpression` + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } /** * Visits a logical binary expression containing `yield`. * @@ -89750,38 +89807,6 @@ var ts; markLabel(resultLabel); return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - var pendingExpressions = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - function visit(node) { - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(1 /* Statement */, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); - } - } - } /** * Visits a conditional expression containing `yield`. *