Remove the instanceof AlternateCS check in ColorSpace.parse since it's dead code

Looking at `ColorSpace.parseToIR`, it will do one of the following things when called:
 1. Return a String.
 2. Return an Array.
 3. Throw a `FormatError`.
 4. In one case, return the result of *another* `ColorSpace.parseToIR` call.

However, under no circumstances will it ever return an `AlternateCS` instance.

Since it's often useful to understand why code, which has become unused, existed in the first place, let's grab a hard hat and a shovel and start digging through the history of this code :-)

The current condition was introduced in commit c198ec4323, in PR 794, but it was actually already obsolete by that time.
The preceeding `instanceof SeparationCS` condition predates commit a7278b7fbc, in PR 700.
That condition was originally introduced all the way back in commit 4e3f87b60c, in PR 692. However, it was made obsolete by commit 9dcefe1efc, which is included in the very same PR!

Hence we're left with the conclusion that not only has this code be unused for *almost* six years, it was basically never used at all save for a few refactoring commits that're part of PR 692.
This commit is contained in:
Jonas Jenwald 2017-09-23 13:59:43 +02:00
parent d7b37ae745
commit 8a084aff0f

View File

@ -201,10 +201,7 @@ var ColorSpace = (function ColorSpaceClosure() {
};
ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
var IR = ColorSpace.parseToIR(cs, xref, res);
if (IR instanceof AlternateCS) {
return IR;
}
let IR = ColorSpace.parseToIR(cs, xref, res);
return ColorSpace.fromIR(IR);
};