Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 2f5d78c

Browse files
author
Daniel Wirtz
committed
Better validation, will break the tests
1 parent 330b0bc commit 2f5d78c

File tree

9 files changed

+39
-23
lines changed

9 files changed

+39
-23
lines changed

contrib/ByteBuffer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,14 @@ ByteBuffer.prototype.readCString = function(offset) {};
662662
/**
663663
* @param {*} data
664664
* @param {number=} offset
665-
* @param {function=} stringify
665+
* @param {(function(*):string)=} stringify
666666
* @return {!ByteBuffer|number}
667667
*/
668668
ByteBuffer.prototype.writeJSON = function(data, offset, stringify) {};
669669

670670
/**
671671
* @param {number=} offset
672-
* @param {function=} parse
672+
* @param {(function(string):*)=} parse
673673
* @return {*|!{data: *, length: number}}
674674
* @throws {Error}
675675
*/

contrib/Express.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,37 @@
2222
*/
2323

2424
/**
25-
* @type {function(new:Application, ...)}
25+
* @type {function(new:Application, ...[*])}
2626
*/
2727
function express() {}
2828

2929
/**
30-
* @type {@function(new:Application, ...}}
30+
* @type {function(new:Application, ...[*])}
3131
*/
3232
express.application = function() {};
3333

3434
/**
35-
* @type {@function(new:ExpressRequest, ...)}
35+
* @type {function(new:ExpressRequest, ...[*])}
3636
*/
3737
express.request = function() {};
3838

3939
/**
40-
* @type {@function(new:ExpressResponse, ...)}
40+
* @type {function(new:ExpressResponse, ...[*])}
4141
*/
4242
express.response = function() {};
4343

4444
/**
45-
* @type {@function(new:ExpressRoute, ...})
45+
* @type {function(new:ExpressRoute, ...[*])}
4646
*/
4747
express.Route = function() {};
4848

4949
/**
50-
* @type {@function(new:ExpressRouter, ...})
50+
* @type {function(new:ExpressRouter, ...[*])}
5151
*/
5252
express.Router = function() {};
5353

5454
/**
55-
* @type {@function(...)}
55+
* @type {?function(...[*])}
5656
*/
5757
express.errorHandler = function() {};
5858

contrib/JustMath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ JustMath.Vec2.prototype.norm = function() {};
266266
/**
267267
* @param {!JustMath.Vec2} b
268268
* @return {number}
269-
* @nosideffects
269+
* @nosideeffects
270270
*/
271271
JustMath.Vec2.prototype.distSq = function(b) {};
272272

contrib/Require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ define.amd;
4242
function requirejs(deps, callback, errback, optional) {}
4343

4444
/**
45-
* @typedef {{nodeRequire: boolean=, baseUrl: string, paths: Object.<string,string>, shim: Object.<string,string>}}
45+
* @typedef {{nodeRequire: ?boolean, baseUrl: string, paths: Object.<string,string>, shim: Object.<string,string>}}
4646
*/
4747
var RequireConfig;
4848

contrib/Ws.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ws.WebSocket.prototype.resume = function() {};
119119
/**
120120
* @param {*} data
121121
* @param {object.<string,*>=} options
122-
* @param {function=} callback
122+
* @param {function(...[*])=} callback
123123
*/
124124
ws.WebSocket.prototype.send = function(data, options, callback) {};
125125

@@ -134,26 +134,21 @@ ws.WebSocket.prototype.stream = function(options, callback) {};
134134
ws.WebSocket.prototype.terminate = function() {};
135135

136136
/**
137-
* @type {?function}
137+
* @type {?function()}
138138
*/
139139
ws.WebSocket.prototype.onopen = function() {};
140140

141141
/**
142-
* @type {?function(*)}
143-
* @param {*} error
142+
* @type {?function(Error)}
144143
*/
145144
ws.WebSocket.prototype.onerror = function(error) {};
146145

147146
/**
148147
* @type {?function(number, string)}
149-
* @param {number} code
150-
* @param {string} message
151148
*/
152149
ws.WebSocket.prototype.onclose = function(code, message) {};
153150

154151
/**
155152
* @type {?function(*, object.<string,*>)}
156-
* @param {*} data
157-
* @param {object.<string,*>} flags
158153
*/
159154
ws.WebSocket.prototype.onmessage = function(data, flags) {};

crypto.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,12 @@ crypto.DiffieHellman.prototype.setPrivateKey = function(key, encoding) {};
351351
crypto.DiffieHellmanGroup = function(name) {};
352352

353353
/**
354-
* @alias crypto.DiffieHellman.prototype.generateKeys
354+
* TODO: Not sure if this works.
355355
*/
356356
crypto.DiffieHellmanGroup.prototype.generateKeys = crypto.DiffieHellman.prototype.generateKeys;
357357

358358
/**
359-
* @alias crypto.DiffieHellman.prototype.computeSecret
359+
* TODO: Not sure if this works.
360360
*/
361361
crypto.DiffieHellmanGroup.prototype.computeSecret = crypto.DiffieHellman.prototype.computeSecret;
362362

File renamed without changes.

tests/noop.js

Whitespace-only changes.

tests/validate.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,30 @@
1818
* Validate Script: Tries to validate the existing externs by including them in a compile step.
1919
*/
2020

21-
var ClosureCompiler = require("closurecompiler");
21+
var ClosureCompiler = require("closurecompiler"),
22+
fs = require("fs");
2223

23-
ClosureCompiler.compile(__filename, {compilation_level: "ADVANCED_OPTIMIZATIONS", "externs": [".", "./contrib"]}, function(error, result) {
24+
var externs = [];
25+
var pattern = /\.js$/;
26+
var files = fs.readdirSync(".");
27+
for (var i=0; i<files.length; i++) {
28+
if (pattern.test(files[i])) {
29+
externs.push("./"+files[i]);
30+
}
31+
}
32+
files = fs.readdirSync("./contrib");
33+
for (i=0; i<files.length; i++) {
34+
if (pattern.test(files[i])) {
35+
externs.push("./contrib/"+files[i]);
36+
}
37+
}
38+
39+
console.log("Validating "+externs.length+" files:\n", externs);
40+
ClosureCompiler.compile("./tests/noop.js", {
41+
"compilation_level": "ADVANCED_OPTIMIZATIONS",
42+
"warning_level": "verbose",
43+
"externs": externs
44+
}, function(error, result) {
2445
if (error) {
2546
throw(error);
2647
}

0 commit comments

Comments
 (0)