Skip to content

Commit

Permalink
Fix annotation mistakes
Browse files Browse the repository at this point in the history
These mistakes were all uncovered by a forthcoming release of the
Closure compiler.

Change-Id: I84a742cd8fae36cc013f86ff7ae06e7f76501b56
  • Loading branch information
joeyparrish committed Nov 18, 2015
1 parent 5fe357f commit a24b8e8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 56 deletions.
4 changes: 2 additions & 2 deletions externs/mediakeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ MediaKeyStatusMap.prototype.entries = function() {};


/**
* The functor is called with each value.
* @param {function(string)} fn
* The functor is called with each value and key.
* @param {function(string, BufferSource)} fn
*/
MediaKeyStatusMap.prototype.forEach = function(fn) {};

Expand Down
6 changes: 3 additions & 3 deletions lib/player/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ shaka.player.Stats = function() {
* Bandwidth history. Each timestamped value is a bandwidth measurement, in
* bits per second.
*
* @type {!Array.<shaka.player.Stats.TimedValue.<number>>}
* @type {!Array.<!shaka.player.Stats.TimedValue.<number>>}
* @expose
*/
this.bandwidthHistory = [];
Expand All @@ -106,8 +106,8 @@ shaka.player.Stats = function() {
* StreamInfo history. Each timestamped value is a stream chosen
* by the player.
*
* @type {!Array.<shaka.player.Stats.TimedValue.<
* shaka.player.Stats.StreamStats>>}
* @type {!Array.<!shaka.player.Stats.TimedValue.<
* !shaka.player.Stats.StreamStats>>}
* @expose
*/
this.streamHistory = [];
Expand Down
32 changes: 9 additions & 23 deletions lib/polyfill/patchedmediakeys_20140218.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,7 @@ shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
};


/**
* Array entry 0 is the key, 1 is the value.
* @return {Iterator.<Array.<!BufferSource|string>>}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
entries = function() {
var fakeKeyId =
Expand All @@ -798,22 +795,18 @@ shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
};


/**
* The functor is called with each value.
* @param {function(string)} fn
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
forEach = function(fn) {
if (this.status_) {
fn(this.status_);
var fakeKeyId =
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.KEY_ID_;
fn(this.status_, fakeKeyId);
}
};


/**
* @param {!BufferSource} keyId
* @return {string|undefined}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
get = function(keyId) {
if (this.has(keyId)) {
Expand All @@ -823,10 +816,7 @@ shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
};


/**
* @param {!BufferSource} keyId
* @return {boolean}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
has = function(keyId) {
var fakeKeyId =
Expand All @@ -839,9 +829,7 @@ shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
};


/**
* @return {Iterator.<!BufferSource>}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
keys = function() {
var fakeKeyId =
Expand All @@ -855,9 +843,7 @@ shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
};


/**
* @return {Iterator.<string>}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v20140218.MediaKeyStatusMap.prototype.
values = function() {
/** @type {!Array.<string>} */
Expand Down
35 changes: 10 additions & 25 deletions lib/polyfill/patchedmediakeys_v01b.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ shaka.polyfill.PatchedMediaKeys.v01b.setMediaKeys = function(mediaKeys) {
*/
shaka.polyfill.PatchedMediaKeys.v01b.getVideoElement_ = function() {
var videos = document.getElementsByTagName('video');
/** @type {!HTMLVideoElement} */
var tmpVideo = videos.length ? videos[0] : document.createElement('video');
return tmpVideo;
return /** @type {!HTMLVideoElement} */(tmpVideo);
};


Expand Down Expand Up @@ -923,10 +922,7 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.getStatus =
};


/**
* Array entry 0 is the key, 1 is the value.
* @override
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.entries =
function() {
var fakeKeyId =
Expand All @@ -940,22 +936,18 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.entries =
};


/**
* The functor is called with each value.
* @param {function(string)} fn
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.forEach =
function(fn) {
if (this.status_) {
fn(this.status_);
var fakeKeyId =
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.KEY_ID_;
fn(this.status_, fakeKeyId);
}
};


/**
* @param {BufferSource} keyId
* @return {string|undefined}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.get =
function(keyId) {
if (this.has(keyId)) {
Expand All @@ -965,10 +957,7 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.get =
};


/**
* @param {BufferSource} keyId
* @return {boolean}
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.has =
function(keyId) {
var fakeKeyId =
Expand All @@ -981,9 +970,7 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.has =
};


/**
* @override
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.keys =
function() {
var fakeKeyId =
Expand All @@ -997,9 +984,7 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.keys =
};


/**
* @override
*/
/** @override */
shaka.polyfill.PatchedMediaKeys.v01b.MediaKeyStatusMap.prototype.values =
function() {
/** @type {!Array.<string>} */
Expand Down
7 changes: 6 additions & 1 deletion lib/polyfill/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ shaka.polyfill.Promise = function(opt_callback) {
};


/** @typedef {{ promise: !shaka.polyfill.Promise, callback: function(*) }} */
/**
* @typedef {{
* promise: !shaka.polyfill.Promise,
* callback: (function(*)|undefined)
* }}
*/
shaka.polyfill.Promise.Child;


Expand Down
3 changes: 1 addition & 2 deletions lib/util/content_database.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ shaka.util.ContentDatabase.StreamIndex;

/**
* @typedef {{
* index: number,
* start_time: number,
* end_time: number,
* end_time: ?number,
* start_byte: number,
* url: string
* }}
Expand Down

0 comments on commit a24b8e8

Please sign in to comment.