1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Change the signature of the Parser constructor to take a parameter object

A lot of the `new Parser()` call-sites look quite unwieldy/ugly as-is, with a bunch of somewhat randomly ordered arguments, which we can avoid by changing the constructor to accept an object instead. As an added bonus, this provides better documentation without having to add inline argument comments in the code.
This commit is contained in:
Jonas Jenwald 2019-06-23 16:01:45 +02:00
parent 1c9a69db82
commit f710eb56e4
5 changed files with 53 additions and 21 deletions

View file

@ -2960,7 +2960,10 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
this.opMap = getOPMap();
// TODO(mduan): pass array of knownCommands rather than this.opMap
// dictionary
this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
this.parser = new Parser({
lexer: new Lexer(stream, this.opMap),
xref,
});
this.stateManager = stateManager;
this.nonProcessedArgs = [];
this._numInvalidPathOPS = 0;