mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-23 11:21:02 +02:00
Enable the ESLint no-var rule in the src/core/evaluator.js file
This was previously attempted in PR 13371, but had to be reverted because of issues related to SystemJS (which has since been removed). Also, while unrelated, shortens an existing conditional assignment.
This commit is contained in:
parent
9bf9bbda0b
commit
c082169cae
@ -12,7 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable no-var */
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AbortException,
|
AbortException,
|
||||||
@ -1887,7 +1886,7 @@ class PartialEvaluator {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
case OPS.setFont:
|
case OPS.setFont:
|
||||||
var fontSize = args[1];
|
const fontSize = args[1];
|
||||||
// eagerly collect all fonts
|
// eagerly collect all fonts
|
||||||
next(
|
next(
|
||||||
self
|
self
|
||||||
@ -1913,7 +1912,7 @@ class PartialEvaluator {
|
|||||||
parsingText = false;
|
parsingText = false;
|
||||||
break;
|
break;
|
||||||
case OPS.endInlineImage:
|
case OPS.endInlineImage:
|
||||||
var cacheKey = args[0].cacheKey;
|
const cacheKey = args[0].cacheKey;
|
||||||
if (cacheKey) {
|
if (cacheKey) {
|
||||||
const localImage = localImageCache.getByName(cacheKey);
|
const localImage = localImageCache.getByName(cacheKey);
|
||||||
if (localImage) {
|
if (localImage) {
|
||||||
@ -1946,8 +1945,8 @@ class PartialEvaluator {
|
|||||||
self.ensureStateFont(stateManager.state);
|
self.ensureStateFont(stateManager.state);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var combinedGlyphs = [];
|
const combinedGlyphs = [],
|
||||||
var state = stateManager.state;
|
state = stateManager.state;
|
||||||
for (const arrItem of args[0]) {
|
for (const arrItem of args[0]) {
|
||||||
if (typeof arrItem === "string") {
|
if (typeof arrItem === "string") {
|
||||||
combinedGlyphs.push(...self.handleText(arrItem, state));
|
combinedGlyphs.push(...self.handleText(arrItem, state));
|
||||||
@ -3079,6 +3078,8 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
const operation = {};
|
const operation = {};
|
||||||
let stop,
|
let stop,
|
||||||
|
name,
|
||||||
|
isValidName,
|
||||||
args = [];
|
args = [];
|
||||||
while (!(stop = timeSlotManager.check())) {
|
while (!(stop = timeSlotManager.check())) {
|
||||||
// The arguments parsed by read() are not used beyond this loop, so
|
// The arguments parsed by read() are not used beyond this loop, so
|
||||||
@ -3098,7 +3099,7 @@ class PartialEvaluator {
|
|||||||
switch (fn | 0) {
|
switch (fn | 0) {
|
||||||
case OPS.setFont:
|
case OPS.setFont:
|
||||||
// Optimization to ignore multiple identical Tf commands.
|
// Optimization to ignore multiple identical Tf commands.
|
||||||
var fontNameArg = args[0].name,
|
const fontNameArg = args[0].name,
|
||||||
fontSizeArg = args[1];
|
fontSizeArg = args[1];
|
||||||
if (
|
if (
|
||||||
textState.font &&
|
textState.font &&
|
||||||
@ -3239,12 +3240,10 @@ class PartialEvaluator {
|
|||||||
break;
|
break;
|
||||||
case OPS.paintXObject:
|
case OPS.paintXObject:
|
||||||
flushTextContentItem();
|
flushTextContentItem();
|
||||||
if (!xobjs) {
|
xobjs ??= resources.get("XObject") || Dict.empty;
|
||||||
xobjs = resources.get("XObject") || Dict.empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
var isValidName = args[0] instanceof Name;
|
isValidName = args[0] instanceof Name;
|
||||||
var name = args[0].name;
|
name = args[0].name;
|
||||||
|
|
||||||
if (isValidName && emptyXObjectCache.getByName(name)) {
|
if (isValidName && emptyXObjectCache.getByName(name)) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user