Make all typedefs work without provide/require

This commit is contained in:
Andreas Hocevar
2016-06-14 16:18:43 +02:00
committed by Peter Robins
parent 2c29512c80
commit 1d20215bfa
6 changed files with 16 additions and 26 deletions
-1
View File
@@ -3,7 +3,6 @@ goog.provide('ol.events.EventType');
goog.provide('ol.events.KeyCode'); goog.provide('ol.events.KeyCode');
goog.require('ol.object'); goog.require('ol.object');
goog.require('ol.EventTargetLike');
/** /**
+1
View File
@@ -5,6 +5,7 @@ goog.require('ol.Disposable');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
/** /**
* @classdesc * @classdesc
* A simplified implementation of the W3C DOM Level 2 EventTarget interface. * A simplified implementation of the W3C DOM Level 2 EventTarget interface.
+1 -3
View File
@@ -18,8 +18,6 @@ goog.provide('ol.format.ogc.filter.IsNull');
goog.provide('ol.format.ogc.filter.IsBetween'); goog.provide('ol.format.ogc.filter.IsBetween');
goog.provide('ol.format.ogc.filter.IsLike'); goog.provide('ol.format.ogc.filter.IsLike');
goog.require('ol.Extent');
/** /**
* Create a logical `<And>` operator between two filter conditions. * Create a logical `<And>` operator between two filter conditions.
@@ -365,7 +363,7 @@ ol.format.ogc.filter.Bbox = function(geometryName, extent, opt_srsName) {
/** /**
* @public * @public
* @type {!ol.Extent} * @type {ol.Extent}
*/ */
this.extent = extent; this.extent = extent;
+4 -4
View File
@@ -133,7 +133,7 @@ ol.structs.LRUCache.prototype.get = function(key) {
if (entry === this.newest_) { if (entry === this.newest_) {
return entry.value_; return entry.value_;
} else if (entry === this.oldest_) { } else if (entry === this.oldest_) {
this.oldest_ = this.oldest_.newer; this.oldest_ = /** @type {ol.LRUCacheEntry} */ (this.oldest_.newer);
this.oldest_.older = null; this.oldest_.older = null;
} else { } else {
entry.newer.older = entry.older; entry.newer.older = entry.older;
@@ -216,7 +216,7 @@ ol.structs.LRUCache.prototype.pop = function() {
if (entry.newer) { if (entry.newer) {
entry.newer.older = null; entry.newer.older = null;
} }
this.oldest_ = entry.newer; this.oldest_ = /** @type {ol.LRUCacheEntry} */ (entry.newer);
if (!this.oldest_) { if (!this.oldest_) {
this.newest_ = null; this.newest_ = null;
} }
@@ -244,12 +244,12 @@ ol.structs.LRUCache.prototype.set = function(key, value) {
'key is not a standard property of objects (e.g. "__proto__")'); 'key is not a standard property of objects (e.g. "__proto__")');
goog.asserts.assert(!(key in this.entries_), goog.asserts.assert(!(key in this.entries_),
'key is not used already'); 'key is not used already');
var entry = { var entry = /** @type {ol.LRUCacheEntry} */ ({
key_: key, key_: key,
newer: null, newer: null,
older: this.newest_, older: this.newest_,
value_: value value_: value
}; });
if (!this.newest_) { if (!this.newest_) {
this.oldest_ = entry; this.oldest_ = entry;
} else { } else {
+9 -18
View File
@@ -11,13 +11,7 @@
* appear in module code. * appear in module code.
* *
* They are now all in the `ol` namespace. * They are now all in the `ol` namespace.
*
* In principle, typedefs should not have a `goog.provide` nor should files which
* refer to a typedef in comments need a `goog.require`. However, goog.provides
* are needed for 2 cases, both to prevent compiler errors/warnings.
*/ */
goog.provide('ol.Extent');
goog.provide('ol.EventTargetLike');
/** /**
@@ -126,7 +120,7 @@ ol.ColorLike;
/** /**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`. * An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array.<number>} ol.Coordinate * @typedef {Array.<number>}
*/ */
ol.Coordinate; ol.Coordinate;
@@ -161,15 +155,6 @@ ol.DragBoxEndConditionType;
ol.DrawGeometryFunctionType; ol.DrawGeometryFunctionType;
/**
* @typedef {EventTarget|ol.events.EventTarget|
* {addEventListener: function(string, Function, boolean=),
* removeEventListener: function(string, Function, boolean=),
* dispatchEvent: function(string)}}
*/
ol.EventTargetLike;
/** /**
* A function that takes an {@link ol.MapBrowserEvent} and returns a * A function that takes an {@link ol.MapBrowserEvent} and returns a
* `{boolean}`. If the condition is met, true should be returned. * `{boolean}`. If the condition is met, true should be returned.
@@ -202,6 +187,12 @@ ol.EventsKey;
ol.EventsListenerFunctionType; ol.EventsListenerFunctionType;
/**
* @typedef {EventTarget|ol.events.EventTarget}
*/
ol.EventTargetLike;
/** /**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
* @typedef {Array.<number>} * @typedef {Array.<number>}
@@ -318,8 +309,8 @@ ol.LoadingStrategy;
/** /**
* @typedef {{key_: string, * @typedef {{key_: string,
* newer: ol.LRUCacheEntry, * newer: Object,
* older: ol.LRUCacheEntry, * older: Object,
* value_: *}} * value_: *}}
*/ */
ol.LRUCacheEntry; ol.LRUCacheEntry;
+1
View File
@@ -206,6 +206,7 @@ function build(config, paths, callback) {
concatenate(paths, callback); concatenate(paths, callback);
} else { } else {
log.info('ol', 'Compiling ' + paths.length + ' sources'); log.info('ol', 'Compiling ' + paths.length + ' sources');
paths = paths.concat('src/ol/typedefs.js');
options.compile.js = paths.concat(options.compile.js || []); options.compile.js = paths.concat(options.compile.js || []);
closure.compile(options, callback); closure.compile(options, callback);
} }