Added test cases with inheritance

This commit is contained in:
Napalys Klicius
2025-04-29 12:31:34 +02:00
parent ee3a3bd9f5
commit 4fbf8ca5cf
2 changed files with 73 additions and 4 deletions

View File

@@ -2,6 +2,9 @@ spuriousCallee
missingCallee
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
| prototypes.js:7:5:7:16 | this.greet() | prototypes.js:59:8:63:3 | () { \\n ... ); \\n } | -1 | calls |
| prototypes.js:62:5:62:34 | Baz.pro ... l(this) | prototypes.js:10:8:10:39 | () { co ... et"); } | -1 | calls |
| prototypes.js:77:3:77:32 | Baz.pro ... l(this) | prototypes.js:14:23:14:62 | functio ... ut"); } | -1 | calls |
badAnnotation
accessorCall
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |

View File

@@ -1,16 +1,19 @@
import 'dummy'
class Baz {
baz() {
/** calls:Baz.greet */
console.log("Baz baz");
/** calls:Baz.greet calls:Derived.greet1 calls:BazExtented.greet2 */
this.greet();
}
/** name:Baz.greet */
greet() {}
greet() { console.log("Baz greet"); }
}
/** name:Baz.shout */
Baz.prototype.shout = function() {};
Baz.prototype.shout = function() { console.log("Baz shout"); };
/** name:Baz.staticShout */
Baz.staticShout = function() {};
Baz.staticShout = function() { console.log("Baz staticShout"); };
function foo(baz){
/** calls:Baz.greet */
@@ -23,3 +26,66 @@ function foo(baz){
const baz = new Baz();
foo(baz);
class Derived extends Baz {
/** name:Derived.greet1 */
greet() {
console.log("Derived greet");
super.greet();
}
/** name:Derived.shout1 */
shout() {
console.log("Derived shout");
super.shout();
}
}
function bar(derived){
/** calls:Derived.greet1 */
derived.greet();
/** calls:Derived.shout1 */
derived.shout();
}
bar(new Derived());
class BazExtented {
constructor() {
console.log("BazExtented construct");
}
/** name:BazExtented.greet2 */
greet() {
console.log("BazExtented greet");
/** calls:Baz.greet */
Baz.prototype.greet.call(this);
};
}
BazExtented.prototype = Object.create(Baz.prototype);
BazExtented.prototype.constructor = BazExtented;
BazExtented.staticShout = Baz.staticShout;
/** name:BazExtented.talk */
BazExtented.prototype.talk = function() { console.log("BazExtented talk"); };
/** name:BazExtented.shout2 */
BazExtented.prototype.shout = function() {
console.log("BazExtented shout");
/** calls:Baz.shout */
Baz.prototype.shout.call(this);
};
function barbar(bazExtented){
/** calls:BazExtented.talk */
bazExtented.talk();
/** calls:BazExtented.shout2 */
bazExtented.shout();
/** calls:BazExtented.greet2 */
bazExtented.greet();
/** calls:Baz.staticShout */
BazExtented.staticShout();
}
barbar(new BazExtented());