Browse Source

EAGLESIX-2651: Nary: fixes for require ordering

Kyle P Davis 11 years ago
parent
commit
3d6f1ca3e8

+ 5 - 6
lib/pipeline/expressions/NaryExpression.js

@@ -1,9 +1,5 @@
 "use strict";
 
-var Expression = require("./Expression"),
-	Variables = require("./Variables"),
-	ConstantExpression = require("./ConstantExpression");
-
 /**
  * The base class for all n-ary `Expression`s
  * @class NaryExpression
@@ -11,12 +7,15 @@ var Expression = require("./Expression"),
  * @module mungedb-aggregate
  * @extends mungedb-aggregate.pipeline.expressions.Expression
  * @constructor
- **/
+ */
 var NaryExpression = module.exports = function NaryExpression() {
 	if (arguments.length !== 0) throw new Error("Zero args expected");
 	this.operands = [];
 	base.call(this);
-}, klass = NaryExpression, base = Expression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
+}, klass = NaryExpression, Expression = require("./Expression"), base = Expression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
+
+var Variables = require("./Variables"),
+	ConstantExpression = require("./ConstantExpression");
 
 proto.optimize = function optimize() {
 	var n = this.operands.length;

+ 8 - 10
lib/pipeline/expressions/NaryExpressionBaseT.js

@@ -1,21 +1,19 @@
 "use strict";
 
-var NaryExpression = require("./NaryExpression");
-
 /**
-* Inherit from ExpressionVariadic or ExpressionFixedArity instead of directly from this class.
-* @class NaryExpressionBaseT
-* @namespace mungedb-aggregate.pipeline.expressions
-* @module mungedb-aggregate
-* @extends mungedb-aggregate.pipeline.expressions.Expression
-* @constructor
-**/
+ * Inherit from ExpressionVariadic or ExpressionFixedArity instead of directly from this class.
+ * @class NaryExpressionBaseT
+ * @namespace mungedb-aggregate.pipeline.expressions
+ * @module mungedb-aggregate
+ * @extends mungedb-aggregate.pipeline.expressions.Expression
+ * @constructor
+ */
 var NaryExpressionBaseT = module.exports = function NaryExpressionBaseT(SubClass) {
 
 	var NaryExpressionBase = function NaryExpressionBase() {
 		if (arguments.length !== 0) throw new Error(klass.name + "<" + SubClass.name + ">: zero args expected");
 		base.call(this);
-	}, klass = NaryExpressionBase, base = NaryExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
+	}, klass = NaryExpressionBase, NaryExpression = require("./NaryExpression"), base = NaryExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 	klass.parse = function(objExpr, vps) {
 		var expr = new SubClass(),