Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Issue 2766363002: [Closure Externs] Handle optional params sent to an API callback (Closed)

Created:
3 years, 9 months ago by Devlin
Modified:
3 years, 9 months ago
Reviewers:
lazyboy
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -0 lines) Patch
M tools/json_schema_compiler/js_externs_generator_test.py View 3 chunks +10 lines, -0 lines 0 comments Download
M tools/json_schema_compiler/js_util.py View 1 chunk +2 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 14 (9 generated)
Devlin
3 years, 9 months ago (2017-03-22 18:56:59 UTC) #3
lazyboy
lgtm You need to fix the CL description: * @param {function(!FooResponse):void} callback to * @param ...
3 years, 9 months ago (2017-03-22 21:04:32 UTC) #7
Devlin
On 2017/03/22 21:04:32, lazyboy wrote: > lgtm > > You need to fix the CL ...
3 years, 9 months ago (2017-03-22 21:05:51 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2766363002/1
3 years, 9 months ago (2017-03-22 21:07:53 UTC) #11
commit-bot: I haz the power
3 years, 9 months ago (2017-03-22 21:14:16 UTC) #14
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/chromium/src/+/f9c093e54e11cb41c6f3402997a9...

Powered by Google App Engine
This is Rietveld 408576698