Skip to content

Commit

Permalink
[babel 8] Remove DecimalLiteral printing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jan 10, 2025
1 parent 4dfd7e0 commit 92cbaf5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 10 additions & 0 deletions packages/babel-generator/src/generators/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function addDeprecatedGenerators(PrinterClass: typeof Printer) {
if (!process.env.BABEL_8_BREAKING) {
const deprecatedBabel7Generators = {
Noop(this: Printer) {},

TSExpressionWithTypeArguments(
this: Printer,
// @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST
Expand All @@ -16,6 +17,15 @@ export function addDeprecatedGenerators(PrinterClass: typeof Printer) {
this.print(node.expression);
this.print(node.typeParameters);
},

DecimalLiteral(this: Printer, node: any) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw !== undefined) {
this.word(raw);
return;
}
this.word(node.value + "m");
},
};
Object.assign(PrinterClass.prototype, deprecatedBabel7Generators);
}
Expand Down
10 changes: 0 additions & 10 deletions packages/babel-generator/src/generators/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,6 @@ export function BigIntLiteral(this: Printer, node: t.BigIntLiteral) {
this.word(node.value + "n");
}

// TODO: Remove in Babel 8
export function DecimalLiteral(this: Printer, node: any) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw !== undefined) {
this.word(raw);
return;
}
this.word(node.value + "m");
}

// Hack pipe operator
const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]);
export function TopicReference(this: Printer) {
Expand Down

0 comments on commit 92cbaf5

Please sign in to comment.