-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jsii): Erase un-exported base classes
When an exported class extends an un-exported class, merge the declarations of the un-exported base into the exported one, and replace the base class relationship with the base's own base (recursively until an exported base is found, or no further base class is declared - in which case the exported class will not have a base class at all). Declarations from the erased base class(es) will be ignored if there is another declaration with the same name and type in the exported type (or another erased base class that is closer to the exported type in the inheritance chain). Fixes #417
- Loading branch information
1 parent
802fe72
commit 0fbf42b
Showing
5 changed files
with
130 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Un-exported base classes are erased | ||
// https://github.com/awslabs/jsii/issues/417 | ||
// | ||
class JSII417PrivateRoot { | ||
public readonly hasRoot = true; | ||
} | ||
export class JSII417PublicBaseOfBase extends JSII417PrivateRoot { | ||
public static makeInstance(): JSII417PublicBaseOfBase { | ||
return new JSII417PrivateBase("TEST"); | ||
} | ||
public foo() { return; } | ||
} | ||
class JSII417PrivateBase extends JSII417PublicBaseOfBase { | ||
constructor(protected readonly property: string) { | ||
super(); | ||
} | ||
public bar() { return; } | ||
} | ||
export class JSII417Derived extends JSII417PrivateBase { | ||
public bar() { | ||
return super.bar(); | ||
} | ||
public baz() { return; } | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './calculator'; | ||
export * from './compliance'; | ||
export * from './erasures'; |
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