Merge pull request #10938 from Snuffleupagus/fewer-XRef-isCmd
Reduce the number of `isCmd` calls slightly in the `XRef` class
This commit is contained in:
		
						commit
						5517c94d66
					
				@ -20,7 +20,7 @@ import {
 | 
				
			|||||||
  warn
 | 
					  warn
 | 
				
			||||||
} from '../shared/util';
 | 
					} from '../shared/util';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  clearPrimitiveCaches, Dict, isCmd, isDict, isName, isRef, isRefsEqual,
 | 
					  clearPrimitiveCaches, Cmd, Dict, isCmd, isDict, isName, isRef, isRefsEqual,
 | 
				
			||||||
  isStream, Ref, RefSet, RefSetCache
 | 
					  isStream, Ref, RefSet, RefSetCache
 | 
				
			||||||
} from './primitives';
 | 
					} from './primitives';
 | 
				
			||||||
import { Lexer, Parser } from './parser';
 | 
					import { Lexer, Parser } from './parser';
 | 
				
			||||||
@ -1200,10 +1200,15 @@ var XRef = (function XRefClosure() {
 | 
				
			|||||||
          entry.gen = parser.getObj();
 | 
					          entry.gen = parser.getObj();
 | 
				
			||||||
          var type = parser.getObj();
 | 
					          var type = parser.getObj();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (isCmd(type, 'f')) {
 | 
					          if (type instanceof Cmd) {
 | 
				
			||||||
 | 
					            switch (type.cmd) {
 | 
				
			||||||
 | 
					              case 'f':
 | 
				
			||||||
                entry.free = true;
 | 
					                entry.free = true;
 | 
				
			||||||
          } else if (isCmd(type, 'n')) {
 | 
					                break;
 | 
				
			||||||
 | 
					              case 'n':
 | 
				
			||||||
                entry.uncompressed = true;
 | 
					                entry.uncompressed = true;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // Validate entry obj
 | 
					          // Validate entry obj
 | 
				
			||||||
@ -1685,7 +1690,7 @@ var XRef = (function XRefClosure() {
 | 
				
			|||||||
      if (!Number.isInteger(obj2)) {
 | 
					      if (!Number.isInteger(obj2)) {
 | 
				
			||||||
        obj2 = parseInt(obj2, 10);
 | 
					        obj2 = parseInt(obj2, 10);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (obj1 !== num || obj2 !== gen || !isCmd(obj3)) {
 | 
					      if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) {
 | 
				
			||||||
        throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
 | 
					        throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (obj3.cmd !== 'obj') {
 | 
					      if (obj3.cmd !== 'obj') {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user