Index: third_party/jstemplate/util.js |
diff --git a/third_party/jstemplate/util.js b/third_party/jstemplate/util.js |
index beed59162615dfb89ada347a5c7ff861fa19b894..5a8b41e83f6f050a6c6bcd972bd3f1f7482e4326 100644 |
--- a/third_party/jstemplate/util.js |
+++ b/third_party/jstemplate/util.js |
@@ -55,7 +55,12 @@ function jsEval(expr) { |
// function literals in IE. |
// e.g. eval("(function() {})") returns undefined, and not a function |
// object, in IE. |
- return eval('[' + expr + '][0]'); |
+ var object = eval('[' + expr + '][0]'); |
+ if (typeof object != 'object') { |
+ throw new Error('expression of type Object expected, ' + |
+ typeof object + ' found'); |
+ } |
+ return /** @type {Object} */(object); |
} catch (e) { |
log('EVAL FAILED ' + expr + ': ' + e); |
return null; |
@@ -82,9 +87,9 @@ function copyProperties(to, from) { |
/** |
- * @param {Object|null|undefined} value The possible value to use. |
- * @param {Object} defaultValue The default if the value is not set. |
- * @return {Object} The value, if it is |
+ * @param {Object|string|null|undefined} value The possible value to use. |
arv (Not doing code reviews)
2014/09/25 18:46:53
any?
Vitaly Pavlenko
2014/09/25 20:24:42
Done.
|
+ * @param {Object|string} defaultValue The default if the value is not set. |
+ * @return {Object|string} The value, if it is |
* defined and not null; otherwise the default |
*/ |
function getDefaultObject(value, defaultValue) { |
@@ -112,9 +117,9 @@ function isArray(value) { |
/** |
* Finds a slice of an array. |
* |
- * @param {Array} array Array to be sliced. |
+ * @param {Array|Arguments} array Array to be sliced. |
* @param {number} start The start of the slice. |
- * @param {number} opt_end The end of the slice (optional). |
+ * @param {number=} opt_end The end of the slice (optional). |
* @return {Array} array The slice of the array from start to end. |
*/ |
function arraySlice(array, start, opt_end) { |
@@ -125,7 +130,8 @@ function arraySlice(array, start, opt_end) { |
// here because of a bug in the FF and IE implementations of |
// Array.prototype.slice which causes this function to return an empty list |
// if opt_end is not provided. |
- return Function.prototype.call.apply(Array.prototype.slice, arguments); |
+ return /** @type {Array} */( |
+ Function.prototype.call.apply(Array.prototype.slice, arguments)); |
} |
@@ -161,6 +167,7 @@ function arrayClear(array) { |
* |
* @param {Object|null} object The object that the method call targets. |
* @param {Function} method The target method. |
+ * @param {...*} var_args |
* @return {Function} Method with the target object bound to it and curried by |
* the provided arguments. |
*/ |
@@ -420,7 +427,7 @@ function domRemoveNode(node) { |
/** |
* Remove a child from the specified (parent) node. |
* |
- * @param {Element} node Parent element. |
+ * @param {Node} node Parent element. |
* @param {Node} child Child node to remove. |
* @return {Node} Removed node. |
*/ |