Description[Closure Externs] Handle optional params sent to an API callback
An API might conditionally send a response parameter to a caller.
e.g., envision an API:
doStuff({includeResult: true})
which responds with a Result iff includeResult was present and true.
Currently, closure extern generation doesn't handle this case well,
and for a callback like:
callback FooCallback = void(optional FooResponse response);
static void doStuff(DoStuffParams params, FooCallback callback);
generates:
/**
* @param {DoStuffParams} params
* @param {function(!FooResponse):void} callback
*/
But this is incorrect, since it indicates that the response would
never be null.
Properly handle these optional responses, and update the test.
BUG=704242
Review-Url: https://codereview.chromium.org/2766363002
Cr-Commit-Position: refs/heads/master@{#458876}
Committed: https://chromium.googlesource.com/chromium/src/+/f9c093e54e11cb41c6f3402997a97be16568865f
Patch Set 1 #
Dependent Patchsets: Messages
Total messages: 14 (9 generated)
|