浏览代码

EAGLESIX-2716 Fixed broken variable declaration, added error codes.

Tony Ennis 11 年之前
父节点
当前提交
c88245398a
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      lib/pipeline/expressions/SetIsSubsetExpression.js

+ 4 - 4
lib/pipeline/expressions/SetIsSubsetExpression.js

@@ -40,7 +40,7 @@ var setIsSubsetHelper = function setIsSubsetHelper(lhs, rhs){
 
 	var rkeys = Object.keys(rhs);
 
-	// do not shortcircuit when lhs.size() > rhs.size()
+	// do not short-circuit when lhs.size() > rhs.size()
 	// because lhs can have redundant entries
 	for (var i = 0; i < lhs.length; i++){
 		if (rkeys.indexOf(JSON.stringify(lhs[i])) < 0) {
@@ -60,8 +60,8 @@ proto.evaluateInternal = function evaluateInternal(vars) {
 	var lhs = this.operands[0].evaluateInternal(vars),
 		rhs = this.operands[1].evaluateInternal(vars);
 
-	if (!(lhs instanceof Array)) throw new Error("Both operands of " + this.getOpName() + ": must be arrays. First argument is of type " + typeof lhs);
-	if (!(rhs instanceof Array)) throw new Error("Both operands of " + this.getOpName() + ": must be arrays. First argument is of type " + typeof rhs);
+	if (!(lhs instanceof Array)) throw new Error("Both operands of " + this.getOpName() + ": must be arrays. First argument is of type " + typeof lhs+"; code 17046");
+	if (!(rhs instanceof Array)) throw new Error("Both operands of " + this.getOpName() + ": must be arrays. First argument is of type " + typeof rhs+"; code 17042");
 
 	return setIsSubsetHelper(lhs, Helpers.arrayToSet(rhs));
 
@@ -81,7 +81,7 @@ Optimized.prototype = Object.create(SetIsSubsetExpression.prototype, {
 });
 
 Optimized.prototype.evaluateInternal = function evaluateInternal(vars){
-	lhs = this.operands[0].evaluateInternal(vars);
+	var lhs = this.operands[0].evaluateInternal(vars);
 
 	if (!(lhs instanceof Array)) throw new Error("uassert 17310: both operands of " + this.getOpName() + "  must be arrays. First argument is of type " + typeof lhs);