1
+ import 'dummy'
2
+
1
3
class Baz {
2
4
baz ( ) {
3
- /** calls:Baz.greet */
5
+ console . log ( "Baz baz" ) ;
6
+ /** calls:Baz.greet calls:Derived.greet1 calls:BazExtented.greet2 */
4
7
this . greet ( ) ;
5
8
}
6
9
/** name:Baz.greet */
7
- greet ( ) { }
10
+ greet ( ) { console . log ( "Baz greet" ) ; }
8
11
}
9
12
10
13
/** name:Baz.shout */
11
- Baz . prototype . shout = function ( ) { } ;
14
+ Baz . prototype . shout = function ( ) { console . log ( "Baz shout" ) ; } ;
12
15
/** name:Baz.staticShout */
13
- Baz . staticShout = function ( ) { } ;
16
+ Baz . staticShout = function ( ) { console . log ( "Baz staticShout" ) ; } ;
14
17
15
18
function foo ( baz ) {
16
19
/** calls:Baz.greet */
@@ -23,3 +26,66 @@ function foo(baz){
23
26
24
27
const baz = new Baz ( ) ;
25
28
foo ( baz ) ;
29
+
30
+ class Derived extends Baz {
31
+ /** name:Derived.greet1 */
32
+ greet ( ) {
33
+ console . log ( "Derived greet" ) ;
34
+ super . greet ( ) ;
35
+ }
36
+
37
+ /** name:Derived.shout1 */
38
+ shout ( ) {
39
+ console . log ( "Derived shout" ) ;
40
+ super . shout ( ) ;
41
+ }
42
+ }
43
+
44
+ function bar ( derived ) {
45
+ /** calls:Derived.greet1 */
46
+ derived . greet ( ) ;
47
+ /** calls:Derived.shout1 */
48
+ derived . shout ( ) ;
49
+ }
50
+
51
+ bar ( new Derived ( ) ) ;
52
+
53
+ class BazExtented {
54
+ constructor ( ) {
55
+ console . log ( "BazExtented construct" ) ;
56
+ }
57
+
58
+ /** name:BazExtented.greet2 */
59
+ greet ( ) {
60
+ console . log ( "BazExtented greet" ) ;
61
+ /** calls:Baz.greet */
62
+ Baz . prototype . greet . call ( this ) ;
63
+ } ;
64
+ }
65
+
66
+ BazExtented . prototype = Object . create ( Baz . prototype ) ;
67
+ BazExtented . prototype . constructor = BazExtented ;
68
+ BazExtented . staticShout = Baz . staticShout ;
69
+
70
+ /** name:BazExtented.talk */
71
+ BazExtented . prototype . talk = function ( ) { console . log ( "BazExtented talk" ) ; } ;
72
+
73
+ /** name:BazExtented.shout2 */
74
+ BazExtented . prototype . shout = function ( ) {
75
+ console . log ( "BazExtented shout" ) ;
76
+ /** calls:Baz.shout */
77
+ Baz . prototype . shout . call ( this ) ;
78
+ } ;
79
+
80
+ function barbar ( bazExtented ) {
81
+ /** calls:BazExtented.talk */
82
+ bazExtented . talk ( ) ;
83
+ /** calls:BazExtented.shout2 */
84
+ bazExtented . shout ( ) ;
85
+ /** calls:BazExtented.greet2 */
86
+ bazExtented . greet ( ) ;
87
+ /** calls:Baz.staticShout */
88
+ BazExtented . staticShout ( ) ;
89
+ }
90
+
91
+ barbar ( new BazExtented ( ) ) ;
0 commit comments