Cleanup TaggedTemplateExpression print (#18032)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-10-10 21:33:24 +08:00
1 parent b85bff8d1f
commit b80e9fa795
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -68,7 +68,7 @@ import { printObject } from "./object.js";
import { printProperty } from "./property.js";
import { printStatementSequence } from "./statement.js";
import {
printTaggedTemplateLiteral,
printTaggedTemplateExpression,
printTemplateLiteral,
} from "./template-literal.js";
import { printTernary } from "./ternary.js";
@@ -631,7 +631,7 @@ function printEstree(path, options, print, args) {
case "TemplateLiteral":
return printTemplateLiteral(path, options, print);
case "TaggedTemplateExpression":
return printTaggedTemplateLiteral(path, options, print);
return printTaggedTemplateExpression(path, options, print);
case "PrivateIdentifier":
return ["#", node.name];
case "PrivateName":
+3 -3
View File
@@ -128,7 +128,7 @@ function printTemplateLiteral(path, options, print) {
return parts;
}
function printTaggedTemplateLiteral(path, options, print) {
function printTaggedTemplateExpression(path, options, print) {
const quasiDoc = print("quasi");
const { node } = path;
@@ -142,7 +142,7 @@ function printTaggedTemplateLiteral(path, options, print) {
if (
hasNewlineInRange(
options.originalText,
locEnd(node.typeArguments ?? node.typeParameters ?? node.tag),
locEnd(node.typeArguments ?? node.tag),
locStart(quasiLeadingComment),
)
) {
@@ -311,7 +311,7 @@ function isJestEachTemplateLiteral({ node, parent }) {
export {
escapeTemplateCharacters,
printTaggedTemplateLiteral,
printTaggedTemplateExpression,
printTemplateExpressions,
printTemplateLiteral,
uncookTemplateElementValue,