Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue extending a class from a class from a class (fix #1529)
- Loading branch information
1 parent
f1f995e
commit 435b4da
Showing
5 changed files
with
142 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Issue 1529 - part 1 | ||
|
||
class A { | ||
constructor(n) { | ||
this.name = n; | ||
} | ||
} | ||
class B extends A { | ||
} | ||
class C extends B { | ||
} | ||
new A(); // ok | ||
new B(); // ok | ||
var cInst = new C("Test"); // was stack overflow | ||
|
||
// Issue 1529 - part 2 | ||
class Being { | ||
constructor(theLabel) { | ||
this.label = theLabel; | ||
} | ||
|
||
name() { | ||
return this.label; | ||
} | ||
} | ||
|
||
class Animal extends Being { | ||
constructor(theLabel) { | ||
super(theLabel); | ||
} | ||
} | ||
|
||
class Dog extends Animal { | ||
constructor(theLabel) { | ||
super(theLabel); | ||
} | ||
} | ||
|
||
class Cat extends Animal { | ||
constructor(theLabel) { | ||
super(theLabel); | ||
} | ||
} | ||
|
||
|
||
const c = new Cat("Felix"); | ||
const d = new Dog("Fido"); | ||
result = cInst.name=="Test" && c.name()=="Felix" && d.name()=="Fido"; |