Add strict equalities in src/core/function.js
This commit is contained in:
parent
97b3eadbc4
commit
8f5894d81a
@ -173,7 +173,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||||||
//var mask = IR[8];
|
//var mask = IR[8];
|
||||||
var range = IR[9];
|
var range = IR[9];
|
||||||
|
|
||||||
if (m != args.length) {
|
if (m !== args.length) {
|
||||||
error('Incorrect number of arguments: ' + m + ' != ' +
|
error('Incorrect number of arguments: ' + m + ' != ' +
|
||||||
args.length);
|
args.length);
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||||||
var length = diff.length;
|
var length = diff.length;
|
||||||
|
|
||||||
return function constructInterpolatedFromIRResult(args) {
|
return function constructInterpolatedFromIRResult(args) {
|
||||||
var x = n == 1 ? args[0] : Math.pow(args[0], n);
|
var x = (n === 1 ? args[0] : Math.pow(args[0], n));
|
||||||
|
|
||||||
var out = [];
|
var out = [];
|
||||||
for (var j = 0; j < length; ++j) {
|
for (var j = 0; j < length; ++j) {
|
||||||
@ -295,7 +295,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var inputSize = domain.length / 2;
|
var inputSize = domain.length / 2;
|
||||||
if (inputSize != 1) {
|
if (inputSize !== 1) {
|
||||||
error('Bad domain for stiched function');
|
error('Bad domain for stiched function');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||||||
|
|
||||||
function isPDFFunction(v) {
|
function isPDFFunction(v) {
|
||||||
var fnDict;
|
var fnDict;
|
||||||
if (typeof v != 'object') {
|
if (typeof v !== 'object') {
|
||||||
return false;
|
return false;
|
||||||
} else if (isDict(v)) {
|
} else if (isDict(v)) {
|
||||||
fnDict = v;
|
fnDict = v;
|
||||||
@ -513,7 +513,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
|
|||||||
var operator, a, b;
|
var operator, a, b;
|
||||||
while (counter < length) {
|
while (counter < length) {
|
||||||
operator = operators[counter++];
|
operator = operators[counter++];
|
||||||
if (typeof operator == 'number') {
|
if (typeof operator === 'number') {
|
||||||
// Operator is really an operand and should be pushed to the stack.
|
// Operator is really an operand and should be pushed to the stack.
|
||||||
stack.push(operator);
|
stack.push(operator);
|
||||||
continue;
|
continue;
|
||||||
@ -594,7 +594,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
|
|||||||
case 'eq':
|
case 'eq':
|
||||||
b = stack.pop();
|
b = stack.pop();
|
||||||
a = stack.pop();
|
a = stack.pop();
|
||||||
stack.push(a == b);
|
stack.push(a === b);
|
||||||
break;
|
break;
|
||||||
case 'exch':
|
case 'exch':
|
||||||
stack.roll(2, 1);
|
stack.roll(2, 1);
|
||||||
@ -661,7 +661,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
|
|||||||
case 'ne':
|
case 'ne':
|
||||||
b = stack.pop();
|
b = stack.pop();
|
||||||
a = stack.pop();
|
a = stack.pop();
|
||||||
stack.push(a != b);
|
stack.push(a !== b);
|
||||||
break;
|
break;
|
||||||
case 'neg':
|
case 'neg':
|
||||||
a = stack.pop();
|
a = stack.pop();
|
||||||
@ -721,7 +721,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
|
|||||||
b = stack.pop();
|
b = stack.pop();
|
||||||
a = stack.pop();
|
a = stack.pop();
|
||||||
if (isBool(a) && isBool(b)) {
|
if (isBool(a) && isBool(b)) {
|
||||||
stack.push(a != b);
|
stack.push(a !== b);
|
||||||
} else {
|
} else {
|
||||||
stack.push(a ^ b);
|
stack.push(a ^ b);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user