From 0f229d537f96ed2e6a945959a5e7b4a2865d6c16 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Tue, 25 Aug 2020 23:22:21 +0200 Subject: [PATCH] Inline the `setup` method in the `parse` method in `src/core/document.js` Now that the `parse` method is simplified we can inline the `setup` method in the `parse` method since it's only two lines of code. This avoids some indirection. --- src/core/document.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index c970399da..cd459f6f7 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -573,7 +573,8 @@ class PDFDocument { } parse(recoveryMode) { - this.setup(recoveryMode); + this.xref.parse(recoveryMode); + this.catalog = new Catalog(this.pdfManager, this.xref); // The `checkHeader` method is called before this method and parses the // version from the header. The specification states in section 7.5.2 @@ -676,11 +677,6 @@ class PDFDocument { this.xref.setStartXRef(this.startXRef); } - setup(recoveryMode) { - this.xref.parse(recoveryMode); - this.catalog = new Catalog(this.pdfManager, this.xref); - } - get numPages() { const linearization = this.linearization; const num = linearization ? linearization.numPages : this.catalog.numPages;