Replaced occurence of throw new Error
with unreachable
where applicable
This commit is contained in:
parent
b327633ad6
commit
1135674647
@ -14,7 +14,8 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
CMapCompressionType, FormatError, isString, MissingDataException, Util, warn
|
||||
CMapCompressionType, FormatError, isString, MissingDataException,
|
||||
unreachable, Util, warn
|
||||
} from '../shared/util';
|
||||
import { isCmd, isEOF, isName, isStream } from './primitives';
|
||||
import { Lexer } from './parser';
|
||||
@ -353,19 +354,19 @@ var IdentityCMap = (function IdentityCMapClosure() {
|
||||
addCodespaceRange: CMap.prototype.addCodespaceRange,
|
||||
|
||||
mapCidRange(low, high, dstLow) {
|
||||
throw new Error('should not call mapCidRange');
|
||||
unreachable('should not call mapCidRange');
|
||||
},
|
||||
|
||||
mapBfRange(low, high, dstLow) {
|
||||
throw new Error('should not call mapBfRange');
|
||||
unreachable('should not call mapBfRange');
|
||||
},
|
||||
|
||||
mapBfRangeToArray(low, high, array) {
|
||||
throw new Error('should not call mapBfRangeToArray');
|
||||
unreachable('should not call mapBfRangeToArray');
|
||||
},
|
||||
|
||||
mapOne(src, dst) {
|
||||
throw new Error('should not call mapCidOne');
|
||||
unreachable('should not call mapCidOne');
|
||||
},
|
||||
|
||||
lookup(code) {
|
||||
@ -402,7 +403,7 @@ var IdentityCMap = (function IdentityCMapClosure() {
|
||||
},
|
||||
|
||||
get isIdentityCMap() {
|
||||
throw new Error('should not access .isIdentityCMap');
|
||||
unreachable('should not access .isIdentityCMap');
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FormatError, info, isString, shadow, warn } from '../shared/util';
|
||||
import {
|
||||
FormatError, info, isString, shadow, unreachable, warn
|
||||
} from '../shared/util';
|
||||
import { isDict, isName, isStream } from './primitives';
|
||||
|
||||
var ColorSpace = (function ColorSpaceClosure() {
|
||||
@ -54,7 +56,7 @@ var ColorSpace = (function ColorSpaceClosure() {
|
||||
|
||||
// Constructor should define this.numComps, this.defaultColor, this.name
|
||||
function ColorSpace() {
|
||||
throw new Error('should not call ColorSpace constructor');
|
||||
unreachable('should not call ColorSpace constructor');
|
||||
}
|
||||
|
||||
ColorSpace.prototype = {
|
||||
@ -74,7 +76,7 @@ var ColorSpace = (function ColorSpaceClosure() {
|
||||
*/
|
||||
getRgbItem: function ColorSpace_getRgbItem(src, srcOffset,
|
||||
dest, destOffset) {
|
||||
throw new Error('Should not call ColorSpace.getRgbItem');
|
||||
unreachable('Should not call ColorSpace.getRgbItem');
|
||||
},
|
||||
/**
|
||||
* Converts the specified number of the color values to the RGB colors.
|
||||
@ -88,7 +90,7 @@ var ColorSpace = (function ColorSpaceClosure() {
|
||||
getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count,
|
||||
dest, destOffset, bits,
|
||||
alpha01) {
|
||||
throw new Error('Should not call ColorSpace.getRgbBuffer');
|
||||
unreachable('Should not call ColorSpace.getRgbBuffer');
|
||||
},
|
||||
/**
|
||||
* Determines the number of bytes required to store the result of the
|
||||
@ -97,7 +99,7 @@ var ColorSpace = (function ColorSpaceClosure() {
|
||||
*/
|
||||
getOutputLength: function ColorSpace_getOutputLength(inputLength,
|
||||
alpha01) {
|
||||
throw new Error('Should not call ColorSpace.getOutputLength');
|
||||
unreachable('Should not call ColorSpace.getOutputLength');
|
||||
},
|
||||
/**
|
||||
* Returns true if source data will be equal the result/output data.
|
||||
|
@ -13,7 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { bytesToString, FormatError, Util } from '../shared/util';
|
||||
import {
|
||||
bytesToString, FormatError, unreachable, Util
|
||||
} from '../shared/util';
|
||||
import { CFFParser } from './cff_parser';
|
||||
import { getGlyphsUnicode } from './glyphlist';
|
||||
import { StandardEncoding } from './encodings';
|
||||
@ -628,7 +630,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
||||
},
|
||||
|
||||
compileGlyphImpl() {
|
||||
throw new Error('Children classes should implement this.');
|
||||
unreachable('Children classes should implement this.');
|
||||
},
|
||||
|
||||
hasBuiltPath(unicode) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import {
|
||||
bytesToString, FONT_IDENTITY_MATRIX, FontType, FormatError, info, isNum,
|
||||
isSpace, MissingDataException, readUint32, shadow, string32, warn
|
||||
isSpace, MissingDataException, readUint32, shadow, string32, unreachable, warn
|
||||
} from '../shared/util';
|
||||
import {
|
||||
CFF, CFFCharset, CFFCompiler, CFFHeader, CFFIndex, CFFParser, CFFPrivateDict,
|
||||
@ -295,7 +295,7 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
|
||||
},
|
||||
|
||||
amend(map) {
|
||||
throw new Error('Should not call amend()');
|
||||
unreachable('Should not call amend()');
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
FormatError, info, isBool, isEvalSupported, shadow
|
||||
FormatError, info, isBool, isEvalSupported, shadow, unreachable
|
||||
} from '../shared/util';
|
||||
import { isDict, isStream } from './primitives';
|
||||
import { PostScriptLexer, PostScriptParser } from './ps_parser';
|
||||
@ -822,7 +822,7 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
|
||||
this.type = type;
|
||||
}
|
||||
AstNode.prototype.visit = function (visitor) {
|
||||
throw new Error('abstract method');
|
||||
unreachable('abstract method');
|
||||
};
|
||||
|
||||
function AstArgument(index, min, max) {
|
||||
|
@ -16,7 +16,8 @@
|
||||
import {
|
||||
bytesToString, createPromiseCapability, createValidAbsoluteUrl, FormatError,
|
||||
info, InvalidPDFException, isBool, isString, MissingDataException, shadow,
|
||||
stringToPDFString, stringToUTF8String, Util, warn, XRefParseException
|
||||
stringToPDFString, stringToUTF8String, unreachable, Util, warn,
|
||||
XRefParseException
|
||||
} from '../shared/util';
|
||||
import {
|
||||
Dict, isCmd, isDict, isName, isRef, isRefsEqual, isStream, Ref, RefSet,
|
||||
@ -1474,7 +1475,7 @@ var XRef = (function XRefClosure() {
|
||||
*/
|
||||
var NameOrNumberTree = (function NameOrNumberTreeClosure() {
|
||||
function NameOrNumberTree(root, xref) {
|
||||
throw new Error('Cannot initialize NameOrNumberTree.');
|
||||
unreachable('Cannot initialize NameOrNumberTree.');
|
||||
}
|
||||
|
||||
NameOrNumberTree.prototype = {
|
||||
|
@ -34,14 +34,14 @@ var ShadingType = {
|
||||
var Pattern = (function PatternClosure() {
|
||||
// Constructor should define this.getPattern
|
||||
function Pattern() {
|
||||
throw new Error('should not call Pattern constructor');
|
||||
unreachable('should not call Pattern constructor');
|
||||
}
|
||||
|
||||
Pattern.prototype = {
|
||||
// Input: current Canvas context
|
||||
// Output: the appropriate fillStyle or strokeStyle
|
||||
getPattern: function Pattern_getPattern(ctx) {
|
||||
throw new Error(`Should not call Pattern.getStyle: ${ctx}`);
|
||||
unreachable(`Should not call Pattern.getStyle: ${ctx}`);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import {
|
||||
createPromiseCapability, createValidAbsoluteUrl, MissingDataException,
|
||||
NotImplementedException, shadow, Util, warn
|
||||
NotImplementedException, shadow, unreachable, Util, warn
|
||||
} from '../shared/util';
|
||||
import { ChunkedStreamManager } from './chunked_stream';
|
||||
import { PDFDocument } from './document';
|
||||
@ -23,7 +23,7 @@ import { Stream } from './stream';
|
||||
|
||||
var BasePdfManager = (function BasePdfManagerClosure() {
|
||||
function BasePdfManager() {
|
||||
throw new Error('Cannot initialize BaseManagerManager');
|
||||
unreachable('Cannot initialize BaseManagerManager');
|
||||
}
|
||||
|
||||
BasePdfManager.prototype = {
|
||||
|
@ -18,7 +18,8 @@ import {
|
||||
getFilenameFromUrl, LinkTarget
|
||||
} from './dom_utils';
|
||||
import {
|
||||
AnnotationBorderStyleType, AnnotationType, stringToPDFString, Util, warn
|
||||
AnnotationBorderStyleType, AnnotationType, stringToPDFString, unreachable,
|
||||
Util, warn
|
||||
} from '../shared/util';
|
||||
|
||||
/**
|
||||
@ -261,7 +262,7 @@ class AnnotationElement {
|
||||
* @memberof AnnotationElement
|
||||
*/
|
||||
render() {
|
||||
throw new Error('Abstract method `AnnotationElement.render` called');
|
||||
unreachable('Abstract method `AnnotationElement.render` called');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@ import {
|
||||
assert, createPromiseCapability, getVerbosityLevel, info, InvalidPDFException,
|
||||
isArrayBuffer, isSameOrigin, loadJpegStream, MessageHandler,
|
||||
MissingPDFException, NativeImageDecoding, PageViewport, PasswordException,
|
||||
stringToBytes, UnexpectedResponseException, UnknownErrorException, Util, warn
|
||||
stringToBytes, UnexpectedResponseException, UnknownErrorException,
|
||||
unreachable, Util, warn
|
||||
} from '../shared/util';
|
||||
import {
|
||||
DOMCanvasFactory, DOMCMapReaderFactory, DummyStatTimer, getDefaultSetting,
|
||||
@ -475,7 +476,7 @@ var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() {
|
||||
|
||||
requestDataRange:
|
||||
function PDFDataRangeTransport_requestDataRange(begin, end) {
|
||||
throw new Error('Abstract method PDFDataRangeTransport.requestDataRange');
|
||||
unreachable('Abstract method PDFDataRangeTransport.requestDataRange');
|
||||
},
|
||||
|
||||
abort: function PDFDataRangeTransport_abort() {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import {
|
||||
FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, info, isLittleEndian, isNum,
|
||||
OPS, shadow, TextRenderingMode, Util, warn
|
||||
OPS, shadow, TextRenderingMode, unreachable, Util, warn
|
||||
} from '../shared/util';
|
||||
import { getShadingPatternFromIR, TilingPattern } from './pattern_helper';
|
||||
|
||||
@ -1733,10 +1733,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
|
||||
// Images
|
||||
beginInlineImage: function CanvasGraphics_beginInlineImage() {
|
||||
throw new Error('Should not call beginInlineImage');
|
||||
unreachable('Should not call beginInlineImage');
|
||||
},
|
||||
beginImageData: function CanvasGraphics_beginImageData() {
|
||||
throw new Error('Should not call beginImageData');
|
||||
unreachable('Should not call beginImageData');
|
||||
},
|
||||
|
||||
paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix,
|
||||
|
@ -14,7 +14,8 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
assert, CMapCompressionType, removeNullCharacters, stringToBytes, warn
|
||||
assert, CMapCompressionType, removeNullCharacters, stringToBytes,
|
||||
unreachable, warn
|
||||
} from '../shared/util';
|
||||
import globalScope from '../shared/global_scope';
|
||||
|
||||
@ -527,7 +528,7 @@ class StatTimer {
|
||||
*/
|
||||
class DummyStatTimer {
|
||||
constructor() {
|
||||
throw new Error('Cannot initialize DummyStatTimer.');
|
||||
unreachable('Cannot initialize DummyStatTimer.');
|
||||
}
|
||||
|
||||
static reset() {}
|
||||
|
Loading…
Reference in New Issue
Block a user