Skip to content

Commit

Permalink
Merge pull request #5205 from nnethercote/setGState-closure
Browse files Browse the repository at this point in the history
Remove setGStateForKey() closure.
  • Loading branch information
yurydelendik committed Aug 18, 2014
2 parents b06dc8d + 96b9af6 commit 6ac995d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
setGState: function PartialEvaluator_setGState(resources, gState,
operatorList, xref,
stateManager) {

// TODO(mack): This should be rewritten so that this function returns
// what should be added to the queue during each iteration
function setGStateForKey(gStateObj, key, value) {
// This array holds the converted/processed state data.
var gStateObj = [];
var gStateMap = gState.map;
var self = this;
var promise = Promise.resolve();
for (var key in gStateMap) {
var value = gStateMap[key];
switch (key) {
case 'Type':
break;
Expand Down Expand Up @@ -435,16 +438,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
break;
}
}

// This array holds the converted/processed state data.
var gStateObj = [];
var gStateMap = gState.map;
var self = this;
var promise = Promise.resolve();
for (var key in gStateMap) {
var value = gStateMap[key];
setGStateForKey(gStateObj, key, value);
}
return promise.then(function () {
if (gStateObj.length >= 0) {
operatorList.addOp(OPS.setGState, [gStateObj]);
Expand Down

0 comments on commit 6ac995d

Please sign in to comment.