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.
This commit is contained in:
Tim van der Meij 2020-08-25 23:22:21 +02:00
parent 280207c740
commit 0f229d537f
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -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;