Expression literal

This commit is contained in:
Tim Schaub
2013-02-19 21:38:10 -07:00
parent 360e37146c
commit 1faa6214f1

View File

@@ -1,4 +1,5 @@
goog.provide('ol.Expression');
goog.provide('ol.ExpressionLiteral');
@@ -41,3 +42,29 @@ ol.Expression.prototype.evaluate = function(opt_thisArg, opt_scope) {
var evaluator = new Function(names.join(','), 'return ' + this.source_);
return evaluator.apply(thisArg, values);
};
/**
* @constructor
* @extends {ol.Expression}
* @param {*} value Literal value.
*/
ol.ExpressionLiteral = function(value) {
/**
* @type {*}
* @private
*/
this.value_ = value;
};
goog.inherits(ol.ExpressionLiteral, ol.Expression);
/**
* @inheritDoc
*/
ol.ExpressionLiteral.prototype.evaluate = function(opt_thisArg, opt_scope) {
return this.value_;
};