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,7 +1,6 @@
|
||||
// FIXME add typedef for stack state objects
|
||||
goog.provide('ol.format.OSMXML');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
@@ -57,9 +56,9 @@ ol.format.OSMXML.prototype.getExtensions = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.format.OSMXML.readNode_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'node', 'localName should be node');
|
||||
ol.DEBUG && console.assert(node.localName == 'node', 'localName should be node');
|
||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var id = node.getAttribute('id');
|
||||
@@ -90,9 +89,9 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
ol.format.OSMXML.readWay_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'way', 'localName should be way');
|
||||
ol.DEBUG && console.assert(node.localName == 'way', 'localName should be way');
|
||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
var id = node.getAttribute('id');
|
||||
var values = ol.xml.pushParseAndPop({
|
||||
@@ -130,9 +129,9 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
ol.format.OSMXML.readNd_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'nd', 'localName should be nd');
|
||||
ol.DEBUG && console.assert(node.localName == 'nd', 'localName should be nd');
|
||||
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
values.ndrefs.push(node.getAttribute('ref'));
|
||||
};
|
||||
@@ -144,9 +143,9 @@ ol.format.OSMXML.readNd_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
ol.format.OSMXML.readTag_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'tag', 'localName should be tag');
|
||||
ol.DEBUG && console.assert(node.localName == 'tag', 'localName should be tag');
|
||||
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
values.tags[node.getAttribute('k')] = node.getAttribute('v');
|
||||
};
|
||||
@@ -213,7 +212,7 @@ ol.format.OSMXML.prototype.readFeatures;
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
|
||||
'node.nodeType should be ELEMENT');
|
||||
var options = this.getReadOptions(node, opt_options);
|
||||
if (node.localName == 'osm') {
|
||||
|
||||
Reference in New Issue
Block a user