There's one problem I don't know yet how to address well. For every exported method ...
6 years, 3 months ago
(2014-09-09 18:36:05 UTC)
#1
There's one problem I don't know yet how to address well. For every exported
method I search for it's private declaration in the class passed to
cr.makePublic(), copy it's JSDoc and create public declaration. But I search for
private method declarations only in the same class, and not in base classes.
There are 9 cases in code base when method is declared in base class.
Vitaly Pavlenko
On 2014/09/09 18:36:05, Vitaly Pavlenko wrote: > There's one problem I don't know yet how ...
6 years, 3 months ago
(2014-09-09 19:15:09 UTC)
#2
On 2014/09/09 18:36:05, Vitaly Pavlenko wrote:
> There's one problem I don't know yet how to address well. For every exported
> method I search for it's private declaration in the class passed to
> cr.makePublic(), copy it's JSDoc and create public declaration. But I search
for
> private method declarations only in the same class, and not in base classes.
> There are 9 cases in code base when method is declared in base class.
Ok, further investigations showed that there are only three such cases. So I can
handle them manually.
Please, review.
Tyler Breisacher (Chromium)
lgtm https://chromiumcodereview.appspot.com/557633002/diff/40001/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java File third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java (right): https://chromiumcodereview.appspot.com/557633002/diff/40001/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java#newcode163 third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java:163: assert publicAPI != null && publicAPI.isArrayLit(); This should ...
6 years, 3 months ago
(2014-09-09 19:34:46 UTC)
#3
I handled another case: when we need to have a dummy declaration on subclass because ...
6 years, 3 months ago
(2014-09-09 21:27:49 UTC)
#5
I handled another case: when we need to have a dummy declaration on subclass
because exported private methods is defined in base class where it's invisible
to our compiler.
Tyler Breisacher (Chromium)
On 2014/09/09 21:27:49, Vitaly Pavlenko wrote: > I handled another case: when we need to ...
6 years, 3 months ago
(2014-09-09 21:31:38 UTC)
#6
On 2014/09/09 21:27:49, Vitaly Pavlenko wrote:
> I handled another case: when we need to have a dummy declaration on subclass
> because exported private methods is defined in base class where it's invisible
> to our compiler.
That's kind of an awkward case. Arguably if the original method is on the base
class then it should also be exported publicly as a static method of that base
class, not the subclass. But I assume it would be kind of a pain to refactor in
that way so this is fine. lgtm
Dan Beam
https://chromiumcodereview.appspot.com/557633002/diff/20001/ui/webui/resources/js/cr.js File ui/webui/resources/js/cr.js (right): https://chromiumcodereview.appspot.com/557633002/diff/20001/ui/webui/resources/js/cr.js#newcode301 ui/webui/resources/js/cr.js:301: * @param {Array.<string>} publicAPI List of public method names ...
6 years, 3 months ago
(2014-09-10 19:26:28 UTC)
#7
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js File chrome/browser/resources/options/automatic_settings_reset_banner.js (right): https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js#newcode54 chrome/browser/resources/options/automatic_settings_reset_banner.js:54: * in the base class. On 2014/09/10 19:26:27, Dan ...
6 years, 3 months ago
(2014-09-10 20:25:22 UTC)
#8
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/browser_options.js File chrome/browser/resources/options/browser_options.js (right): https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/browser_options.js#newcode1934 chrome/browser/resources/options/browser_options.js:1934: BrowserOptions.prototype.updateStartupPages_; Hang on, if this is a private method ...
6 years, 3 months ago
(2014-09-10 20:50:33 UTC)
#9
On 2014/09/10 21:08:19, Dan Beam wrote: > https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/browser_options.js > File chrome/browser/resources/options/browser_options.js (right): > > https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/browser_options.js#newcode1934 ...
6 years, 3 months ago
(2014-09-12 00:20:05 UTC)
#11
On 2014/09/10 21:08:19, Dan Beam wrote:
>
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
> File chrome/browser/resources/options/browser_options.js (right):
>
>
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
> chrome/browser/resources/options/browser_options.js:1934:
> BrowserOptions.prototype.updateStartupPages_;
> On 2014/09/10 20:50:32, Tyler Breisacher (Chromium) wrote:
> > Hang on, if this is a private method of the base class, it shouldn't be
> > accessible here. It should probably be protected, not private, no?
>
> see other comments on this review
So what's the status of this issue?
Dan Beam
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js File chrome/browser/resources/options/automatic_settings_reset_banner.js (right): https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js#newcode54 chrome/browser/resources/options/automatic_settings_reset_banner.js:54: * in the base class. On 2014/09/10 20:25:21, Vitaly ...
6 years, 3 months ago
(2014-09-12 00:57:51 UTC)
#12
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
File chrome/browser/resources/options/automatic_settings_reset_banner.js
(right):
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
chrome/browser/resources/options/automatic_settings_reset_banner.js:54: * in the
base class.
On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> On 2014/09/10 19:26:27, Dan Beam wrote:
> > private methods should not be shared, make this protected
>
> Should I make them protected in base class and here?
yes
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
File chrome/browser/resources/options/browser_options.js (right):
https://chromiumcodereview.appspot.com/557633002/diff/80001/chrome/browser/re...
chrome/browser/resources/options/browser_options.js:1934:
BrowserOptions.prototype.updateStartupPages_;
On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> On 2014/09/10 19:26:27, Dan Beam wrote:
> > please minimize the amount of useless code we write for just the compiler at
> all
> > costs
>
> For this feature I need exactly these three fake declarations, no more.
> Otherwise I can write some kind of suppression options for makePublic, for the
> cost of additional awkward code in JS and in Compiler pass.
>
> So I suggest to leave these three fake declarations. What do you think?
no, if possible, don't add them
https://chromiumcodereview.appspot.com/557633002/diff/80001/third_party/closu...
File
third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
(right):
https://chromiumcodereview.appspot.com/557633002/diff/80001/third_party/closu...
third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java:488:
On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> On 2014/09/10 19:26:27, Dan Beam wrote:
> > what about the case of:
> >
> > function Class() {
> > /** @private */
> > this.doMagic_ = function() {
> > // magic happens
> > };
> > }
>
> Looks like there's no such case right now in Chrome code base. When there
> appears one, we'll spot it via compiler errors like
>
> ERROR: Method "doMagic_" exported by cr.makePublic() on "Class" has no
> declaration.
that's fine
https://chromiumcodereview.appspot.com/557633002/diff/80001/ui/webui/resource...
File ui/webui/resources/js/cr.js (right):
https://chromiumcodereview.appspot.com/557633002/diff/80001/ui/webui/resource...
ui/webui/resources/js/cr.js:330: makePublic: makePublic,
On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> On 2014/09/10 19:26:27, Dan Beam wrote:
> > expose might be a better name if it's apparent enough
>
> So could you propose the best method name to use?
Tyler and I agreed that makePublic is fine
Vitaly Pavlenko
https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js File chrome/browser/resources/options/automatic_settings_reset_banner.js (right): https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources/options/automatic_settings_reset_banner.js#newcode54 chrome/browser/resources/options/automatic_settings_reset_banner.js:54: * in the base class. On 2014/09/12 00:57:51, Dan ...
6 years, 3 months ago
(2014-09-12 18:38:07 UTC)
#13
https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources...
File chrome/browser/resources/options/automatic_settings_reset_banner.js
(right):
https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources...
chrome/browser/resources/options/automatic_settings_reset_banner.js:54: * in the
base class.
On 2014/09/12 00:57:51, Dan Beam wrote:
> On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> > On 2014/09/10 19:26:27, Dan Beam wrote:
> > > private methods should not be shared, make this protected
> >
> > Should I make them protected in base class and here?
>
> yes
Done.
https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources...
File chrome/browser/resources/options/browser_options.js (right):
https://codereview.chromium.org/557633002/diff/80001/chrome/browser/resources...
chrome/browser/resources/options/browser_options.js:1934:
BrowserOptions.prototype.updateStartupPages_;
On 2014/09/12 00:57:51, Dan Beam wrote:
> On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> > On 2014/09/10 19:26:27, Dan Beam wrote:
> > > please minimize the amount of useless code we write for just the compiler
at
> > all
> > > costs
> >
> > For this feature I need exactly these three fake declarations, no more.
> > Otherwise I can write some kind of suppression options for makePublic, for
the
> > cost of additional awkward code in JS and in Compiler pass.
> >
> > So I suggest to leave these three fake declarations. What do you think?
>
> no, if possible, don't add them
Ok, then I'd like to remove that as a dead code :)
https://codereview.chromium.org/557633002/diff/80001/third_party/closure_comp...
File
third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java
(right):
https://codereview.chromium.org/557633002/diff/80001/third_party/closure_comp...
third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java:488:
On 2014/09/12 00:57:51, Dan Beam wrote:
> On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> > On 2014/09/10 19:26:27, Dan Beam wrote:
> > > what about the case of:
> > >
> > > function Class() {
> > > /** @private */
> > > this.doMagic_ = function() {
> > > // magic happens
> > > };
> > > }
> >
> > Looks like there's no such case right now in Chrome code base. When there
> > appears one, we'll spot it via compiler errors like
> >
> > ERROR: Method "doMagic_" exported by cr.makePublic() on "Class" has no
> > declaration.
>
> that's fine
Acknowledged.
https://codereview.chromium.org/557633002/diff/80001/ui/webui/resources/js/cr.js
File ui/webui/resources/js/cr.js (right):
https://codereview.chromium.org/557633002/diff/80001/ui/webui/resources/js/cr...
ui/webui/resources/js/cr.js:330: makePublic: makePublic,
On 2014/09/12 00:57:51, Dan Beam wrote:
> On 2014/09/10 20:25:21, Vitaly Pavlenko wrote:
> > On 2014/09/10 19:26:27, Dan Beam wrote:
> > > expose might be a better name if it's apparent enough
> >
> > So could you propose the best method name to use?
>
> Tyler and I agreed that makePublic is fine
Acknowledged.
https://codereview.chromium.org/557633002/diff/100001/chrome/browser/resource...
File chrome/browser/resources/options/automatic_settings_reset_banner.js
(right):
https://codereview.chromium.org/557633002/diff/100001/chrome/browser/resource...
chrome/browser/resources/options/automatic_settings_reset_banner.js:64:
AutomaticSettingsResetBanner.prototype.dismiss_;
Moved here declarations from base class.
Dan Beam
https://chromiumcodereview.appspot.com/557633002/diff/20001/ui/webui/resources/js/cr.js File ui/webui/resources/js/cr.js (right): https://chromiumcodereview.appspot.com/557633002/diff/20001/ui/webui/resources/js/cr.js#newcode303 ui/webui/resources/js/cr.js:303: * @param {HTMLElement=} opt_target Target node (used in On ...
6 years, 3 months ago
(2014-09-12 23:43:54 UTC)
#14
Issue 557633002: Add public API generation with cr.makePublic() and handle it in compiler pass
(Closed)
Created 6 years, 3 months ago by Vitaly Pavlenko
Modified 6 years, 3 months ago
Reviewers: Dan Beam, Tyler Breisacher (Chromium)
Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_3
Comments: 50