Skip to content

Commit

Permalink
Inline the setup method in the parse method in `src/core/document…
Browse files Browse the repository at this point in the history
….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.
  • Loading branch information
timvandermeij committed Aug 25, 2020
1 parent 280207c commit 0f229d5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0f229d5

Please sign in to comment.