Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/jstemplate/util.js

Issue 603693002: Compile third_party/jstemplate with Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: fix in gyp file Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
*/
« third_party/jstemplate/jsevalcontext.js ('K') | « third_party/jstemplate/jstemplate.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698