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:
@@ -1,6 +1,5 @@
|
||||
goog.provide('ol.geom.Circle');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -163,7 +162,7 @@ ol.geom.Circle.prototype.intersectsExtent = function(extent) {
|
||||
*/
|
||||
ol.geom.Circle.prototype.setCenter = function(center) {
|
||||
var stride = this.stride;
|
||||
goog.asserts.assert(center.length == stride,
|
||||
ol.DEBUG && console.assert(center.length == stride,
|
||||
'center array length should match stride');
|
||||
var radius = this.flatCoordinates[stride] - this.flatCoordinates[0];
|
||||
var flatCoordinates = center.slice();
|
||||
@@ -223,7 +222,7 @@ ol.geom.Circle.prototype.setFlatCoordinates = function(layout, flatCoordinates)
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||
goog.asserts.assert(this.flatCoordinates,
|
||||
ol.DEBUG && console.assert(this.flatCoordinates,
|
||||
'truthy this.flatCoordinates expected');
|
||||
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
|
||||
this.changed();
|
||||
|
||||
Reference in New Issue
Block a user