Skip to content

Commit 3c9719b

Browse files
committed
undo the destructuring of single variable that did not improve the filesize
1 parent 7d3e81f commit 3c9719b

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/slang-printers/print-binary-operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const binaryIndentRulesBuilder =
4444
(shouldIndent: (node: BinaryOperation) => boolean) =>
4545
(path: AstPath<BinaryOperation>) =>
4646
(document: Doc): Doc => {
47-
for (let i = 2, { node } = path; ; i += 2) {
47+
for (let i = 2, node = path.node; ; i += 2) {
4848
const grandparentNode = path.getNode(i) as StrictAstNode;
4949
if (shouldNotIndent(grandparentNode, path, i)) break;
5050
if (!isBinaryOperation(grandparentNode)) return indent(document);

src/slang-printers/print-comments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function printComments(path: AstPath<AstNode>): Doc[] {
1212
const document = joinExisting(
1313
line,
1414
path.map((commentPath) => {
15-
const { node: comment } = commentPath;
15+
const comment = commentPath.node;
1616
if (comment.trailing || comment.leading || comment.printed) {
1717
return '';
1818
}

src/slang-printers/print-logical-operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const logicalGroupRulesBuilder = binaryGroupRulesBuilder(() => false);
2121
const logicalIndentRulesBuilder =
2222
(path: AstPath<BinaryOperation>, options: ParserOptions<AstNode>) =>
2323
(document: Doc): Doc => {
24-
for (let i = 2, { node } = path; ; i += 2) {
24+
for (let i = 2, node = path.node; ; i += 2) {
2525
const grandparentNode = path.getNode(i) as StrictAstNode;
2626
if (shouldNotIndent(grandparentNode, path, i)) break;
2727
if (

src/slang-printers/print-preserving-empty-lines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function printPreservingEmptyLines(
1414
options: ParserOptions<AstNode>
1515
): Doc {
1616
return path.map((childPath) => {
17-
const { node } = childPath;
17+
const node = childPath.node;
1818

1919
return [
2020
// Only attempt to prepend an empty line if `node` is not the first item

src/slang-utils/create-hug-function.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export function createHugFunction(
1010
): (node: Expression) => Expression {
1111
const operators = new Set(huggableOperators);
1212
return (node: Expression): Expression => {
13-
const { variant } = node;
13+
const variant = node.variant;
1414
if (
1515
variant.kind !== TerminalKind.Identifier &&
1616
isBinaryOperation(variant) &&
1717
operators.has(variant.operator)
1818
) {
19-
const { loc } = node;
19+
const loc = node.loc;
2020
return Object.assign(Object.create(Expression.prototype) as Expression, {
2121
kind: NonterminalKind.Expression,
2222
loc: { ...loc },

src/slang-utils/create-parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ function parserAndOutput(
2222
}
2323

2424
function createError(
25-
{ parseOutput }: { parseOutput: ParseOutput },
25+
result: { parseOutput: ParseOutput },
2626
reason: string
2727
): Error {
2828
return new Error(
29-
`We encountered the following syntax error:\n\n\t${parseOutput.errors()[0].message}\n\n${reason}`
29+
`We encountered the following syntax error:\n\n\t${result.parseOutput.errors()[0].message}\n\n${reason}`
3030
);
3131
}
3232

src/slangPrinter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function hasNodeIgnoreComment({ comments }: StrictAstNode): boolean {
1717
}
1818

1919
function ignoreComments(path: AstPath<AstNode>): void {
20-
const { node } = path;
20+
const node = path.node;
2121
// We ignore anything that is not an object
2222
if (node === null || typeof node !== 'object') return;
2323

@@ -55,7 +55,7 @@ function genericPrint(
5555
options: ParserOptions<AstNode>,
5656
print: PrintFunction
5757
): Doc {
58-
const { node } = path;
58+
const node = path.node;
5959

6060
if (hasNodeIgnoreComment(node)) {
6161
ignoreComments(path);

0 commit comments

Comments
 (0)