Remove goog.asserts.*

This pull requests replaces type check hint assertions with type casts,
library sanity check assertions with conditional console.assert statements
in debug mode, and runtime sanity checks with assertions that throw an
ol.AssertionError with an error code for lookup outside the library.
This commit is contained in:
Andreas Hocevar
2016-07-19 16:39:58 +02:00
parent f50f1f401c
commit 6f5ed17fc5
158 changed files with 1488 additions and 1629 deletions

View File

@@ -2,8 +2,6 @@ goog.provide('ol.extent');
goog.provide('ol.extent.Corner');
goog.provide('ol.extent.Relationship');
goog.require('goog.asserts');
/**
* Extent corner.
@@ -55,8 +53,8 @@ ol.extent.boundingExtent = function(coordinates) {
* @return {ol.Extent} Extent.
*/
ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) {
goog.asserts.assert(xs.length > 0, 'xs length should be larger than 0');
goog.asserts.assert(ys.length > 0, 'ys length should be larger than 0');
ol.DEBUG && console.assert(xs.length > 0, 'xs length should be larger than 0');
ol.DEBUG && console.assert(ys.length > 0, 'ys length should be larger than 0');
var minX = Math.min.apply(null, xs);
var minY = Math.min.apply(null, ys);
var maxX = Math.max.apply(null, xs);
@@ -528,10 +526,9 @@ ol.extent.getCorner = function(extent, corner) {
} else if (corner === ol.extent.Corner.TOP_RIGHT) {
coordinate = ol.extent.getTopRight(extent);
} else {
goog.asserts.fail('Invalid corner: %s', corner);
ol.assert(false, 13); // Invalid corner
}
goog.asserts.assert(coordinate, 'coordinate should be defined');
return coordinate;
return /** @type {!ol.Coordinate} */ (coordinate);
};