Skip to content

Commit 6e1487e

Browse files
Fix redundant OFFSET and LIMIT handling code
- Remove unnecessary if/else conditionals where both branches do identical operations - Simplify LIMIT and OFFSET logic while maintaining functionality - Both pretty and non-pretty modes now use the same streamlined code path - All tests continue to pass with simplified logic Co-Authored-By: Dan Lynch <pyramation@gmail.com>
1 parent acfcec5 commit 6e1487e

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

packages/deparser/src/deparser.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -411,23 +411,13 @@ export class Deparser implements DeparserVisitor {
411411
}
412412

413413
if (node.limitCount) {
414-
if (this.formatter.isPretty()) {
415-
output.push('LIMIT');
416-
output.push(this.visit(node.limitCount as Node, context));
417-
} else {
418-
output.push('LIMIT');
419-
output.push(this.visit(node.limitCount as Node, context));
420-
}
414+
output.push('LIMIT');
415+
output.push(this.visit(node.limitCount as Node, context));
421416
}
422417

423418
if (node.limitOffset) {
424-
if (this.formatter.isPretty()) {
425-
output.push('OFFSET');
426-
output.push(this.visit(node.limitOffset as Node, context));
427-
} else {
428-
output.push('OFFSET');
429-
output.push(this.visit(node.limitOffset as Node, context));
430-
}
419+
output.push('OFFSET');
420+
output.push(this.visit(node.limitOffset as Node, context));
431421
}
432422

433423
if (node.lockingClause) {

0 commit comments

Comments
 (0)