|
|
@@ -29,13 +29,25 @@ proto.getOpName = function getOpName(){
|
|
|
* @method evaluate
|
|
|
**/
|
|
|
proto.evaluateInternal = function evaluateInternal(vars) {
|
|
|
- return this.operands.map(function(x) {
|
|
|
- var y = x.evaluateInternal(vars);
|
|
|
- if(typeof(y) !== "string") {
|
|
|
- throw new Error("$concat only supports strings, not "+typeof(y)+"; code 16702");
|
|
|
+ var n = this.operands.length,
|
|
|
+ result = "";
|
|
|
+
|
|
|
+ for (var i = 0; i < n; ++i){
|
|
|
+
|
|
|
+ var value = this.operands[i].evaluateInternal(vars);
|
|
|
+
|
|
|
+ if (value === null || value === undefined){
|
|
|
+ return null;
|
|
|
}
|
|
|
- return y;
|
|
|
- }).join("");
|
|
|
+
|
|
|
+ if (typeof value !== "string"){
|
|
|
+ throw new Error("uassert 16702: " + this.getOpName() + " only supports strings, not " + typeof value);
|
|
|
+ }
|
|
|
+
|
|
|
+ result = result.concat(value);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
};
|
|
|
|
|
|
Expression.registerExpression(klass.opName, base.parse);
|