Browse Source

port ElemMatchValueMatch

Patrick Rigney 11 years ago
parent
commit
7f5e1e242d
1 changed files with 10 additions and 10 deletions
  1. 10 10
      lib/pipeline/matcher/ElemMatchValueMatchExpression.js

+ 10 - 10
lib/pipeline/matcher/ElemMatchValueMatchExpression.js

@@ -1,7 +1,6 @@
 "use strict";
 var ArrayMatchingMatchExpression = require('./ArrayMatchingMatchExpression.js');
 
-// Autogenerated by cport.py on 2013-09-17 14:37
 var ElemMatchValueMatchExpression = module.exports = function ElemMatchValueMatchExpression(){
 	base.call(this);
 	this._matchType = 'ELEM_MATCH_VALUE';
@@ -12,7 +11,6 @@ var ElemMatchValueMatchExpression = module.exports = function ElemMatchValueMatc
 var errors = require("../../Errors.js"),
 	ErrorCodes = errors.ErrorCodes;
 
-// File: expression_array.h lines: 108-108
 proto._subs = undefined;
 
 /**
@@ -23,7 +21,6 @@ proto._subs = undefined;
  *
  */
 proto._arrayElementMatchesAll = function _arrayElementMatchesAll(element){
-	// File: expression_array.cpp lines: 152-157
 	for (var i = 0; i < this._subs.length; i++ ) {
 		if (!this._subs[i].matchesSingleElement(element))
 			return false;
@@ -39,7 +36,6 @@ proto._arrayElementMatchesAll = function _arrayElementMatchesAll(element){
  *
  */
 proto.add = function add(sub){
-	// File: expression_array.cpp lines: 132-134
 	if (!sub) throw new Error(sub + " ElemMatchValueMatchExpression:36");
 	this._subs.push(sub);
 };
@@ -52,9 +48,14 @@ proto.add = function add(sub){
  *
  */
 proto.debugString = function debugString(level){
-	// File: expression_array.cpp lines: 160-165
 	var debug = this._debugAddSpace(level);
 	debug = debug + this.path() + " $elemMatch\n";
+
+	var td = this.getTag();
+	if (td !== null) {
+		debug += " " + td.debugString();
+	}
+	debug += "\n";
 	for (var i = 0; i < this._subs.length; i++) {
 		debug = debug + this._subs[i].debugString(level + 1);
 	}
@@ -69,7 +70,6 @@ proto.debugString = function debugString(level){
  *
  */
 proto.getChild = function getChild(i){
-	// File: expression_array.h lines: 103-102
 	return this._subs[i];
 };
 
@@ -82,7 +82,6 @@ proto.getChild = function getChild(i){
  *
  */
 proto.init = function init(path, sub){
-	// File: expression_array.cpp lines: 121-124
 	this.initPath(path);
 	if (sub)
 		this.add(sub);
@@ -98,7 +97,6 @@ proto.init = function init(path, sub){
  *
  */
 proto.matchesArray = function matchesArray(anArray, details){
-	// File: expression_array.cpp lines: 137-149
 	for (var i in anArray) {
 		var inner = anArray[i];
 
@@ -119,7 +117,6 @@ proto.matchesArray = function matchesArray(anArray, details){
  *
  */
 proto.numChildren = function numChildren(){
-	// File: expression_array.h lines: 102-101
 	return this._subs.length;
 };
 
@@ -130,11 +127,14 @@ proto.numChildren = function numChildren(){
  *
  */
 proto.shallowClone = function shallowClone(){
-	// File: expression_array.h lines: 91-97
 	var element = new ElemMatchValueMatchExpression();
 	element.init(this.path());
 	for (var i = 0; i < this._subs.length; ++i) {
 		element.add(this._subs[i].shallowClone());
 	}
+	var td = this.getTag();
+	if (td) {
+		element.setTag(td.clone());
+	}
 	return element;
 };