Remove the closure used with the PostScriptStack
class
This patch uses the same approach as used in lots of other parts of the code-base, which thus *slightly* reduces the size of this code.
This commit is contained in:
parent
834a638aad
commit
81009d42cf
@ -517,11 +517,11 @@ function isPDFFunction(v) {
|
||||
return fnDict.has("FunctionType");
|
||||
}
|
||||
|
||||
const PostScriptStack = (function PostScriptStackClosure() {
|
||||
const MAX_STACK_SIZE = 100;
|
||||
class PostScriptStack {
|
||||
static get MAX_STACK_SIZE() {
|
||||
return shadow(this, "MAX_STACK_SIZE", 100);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
class PostScriptStack {
|
||||
constructor(initialStack) {
|
||||
this.stack = !initialStack
|
||||
? []
|
||||
@ -529,7 +529,7 @@ const PostScriptStack = (function PostScriptStackClosure() {
|
||||
}
|
||||
|
||||
push(value) {
|
||||
if (this.stack.length >= MAX_STACK_SIZE) {
|
||||
if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
|
||||
throw new Error("PostScript function stack overflow.");
|
||||
}
|
||||
this.stack.push(value);
|
||||
@ -543,7 +543,7 @@ const PostScriptStack = (function PostScriptStackClosure() {
|
||||
}
|
||||
|
||||
copy(n) {
|
||||
if (this.stack.length + n >= MAX_STACK_SIZE) {
|
||||
if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
|
||||
throw new Error("PostScript function stack overflow.");
|
||||
}
|
||||
const stack = this.stack;
|
||||
@ -579,10 +579,7 @@ const PostScriptStack = (function PostScriptStackClosure() {
|
||||
stack[j] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PostScriptStack;
|
||||
})();
|
||||
}
|
||||
|
||||
class PostScriptEvaluator {
|
||||
constructor(operators) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user