Getter for not expression argument

This commit is contained in:
Tim Schaub
2013-06-11 22:56:48 -06:00
parent c05fb8c61b
commit bb1b0cba95
2 changed files with 19 additions and 4 deletions
+13 -4
View File
@@ -614,15 +614,15 @@ ol.expression.Member.prototype.getProperty = function() {
* *
* @constructor * @constructor
* @extends {ol.expression.Expression} * @extends {ol.expression.Expression}
* @param {ol.expression.Expression} expr Expression to negate. * @param {ol.expression.Expression} argument Expression to negate.
*/ */
ol.expression.Not = function(expr) { ol.expression.Not = function(argument) {
/** /**
* @type {ol.expression.Expression} * @type {ol.expression.Expression}
* @private * @private
*/ */
this.expr_ = expr; this.argument_ = argument;
}; };
goog.inherits(ol.expression.Not, ol.expression.Expression); goog.inherits(ol.expression.Not, ol.expression.Expression);
@@ -632,5 +632,14 @@ goog.inherits(ol.expression.Not, ol.expression.Expression);
* @inheritDoc * @inheritDoc
*/ */
ol.expression.Not.prototype.evaluate = function(opt_scope, opt_fns, opt_this) { ol.expression.Not.prototype.evaluate = function(opt_scope, opt_fns, opt_this) {
return !this.expr_.evaluate(opt_scope, opt_fns, opt_this); return !this.argument_.evaluate(opt_scope, opt_fns, opt_this);
};
/**
* Get the argument (the negated expression).
* @return {ol.expression.Expression} The argument.
*/
ol.expression.Not.prototype.getArgument = function() {
return this.argument_;
}; };
@@ -615,6 +615,12 @@ describe('ol.expression.Not', function() {
}); });
}); });
describe('#getArgument()', function() {
var argument = new ol.expression.Literal(true);
var expr = new ol.expression.Not(argument);
expect(expr.getArgument()).to.be(argument);
});
}); });