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

Side by Side Diff: third_party/closure_compiler/tests/getInstance_test.js

Issue 421253006: Add ChromeCodingConvention.java to Closure Compiler to preserve getInstance() type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@A_typechecking_about
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 var cr = {};
2 var myModule = {};
3
4 myModule.Mess = function() {};
5 myModule.Mess.prototype = {
6 whatever: function() {}
7 };
Dan Beam 2014/07/29 18:05:12 ^ unused
Vitaly Pavlenko 2014/07/29 18:53:46 Acknowledged.
8
9 /**
10 * @constructor
11 */
12 myModule.myBaseClass = function() {};
13
14 myModule.myBaseClass.prototype = {
15 /**
16 * @param {number} name
17 */
18 myMethod: function(name) {
19 alert(name);
20 }
21 };
22
23 /**
24 * @constructor
25 * @extends {myModule.myBaseClass}
26 */
27 myModule.myClass = function() {};
28
29 /**
30 * @param {!Function} ctor
31 */
32 cr.addSingletonGetter = function(ctor) {
Dan Beam 2014/07/29 18:05:12 can this file be: var cr = { /** @param {!Funct
Vitaly Pavlenko 2014/07/29 18:53:46 Done.
33 ctor.getInstance = function() {
34 return ctor.instance_ || (ctor.instance_ = new ctor());
35 };
36 };
37
38 cr.addSingletonGetter(myModule.myClass);
39
40 /**
41 * @param {string} name
42 */
43 myModule.myClass.myMethod = function(name) {
44 myModule.myClass.getInstance().whatever();
45 myModule.myClass.getInstance().myMethod(name);
46 };
47
48 myModule.myClass.myMethod('string');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698