-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kernel): calling super.property unexpectedly returns
undefined
(#…
…1932) When overriding a property, the `@jsii/kernel` creates a shadow property for the previous implementation. In order to preserve the existing implementation (whether the property is dynamic or not), the property descriptor is retrieved and re-declared with the new name. This process did not crawl up the prototype chain, and only looked at the object itself. In many cases, this will never return anything (since `Object.getOwnPropertyDescriptor` will not return inherited descriptors) and in this case the `undefined` value was always used. This would break whenever attempting to override a property that was inherited from a parent class, and appears to fail with certain `node` runtimes where the dynamic properties are set on the object's prototype and not on the object itself. This change adds the necessary logic to traverse the prototype chain all the way up to `Object` (not included), to locate the property descriptor and upon failing to identify one, uses the current value of the property instead of `undefined`.
- Loading branch information
1 parent
f63f89e
commit 3b48778
Showing
11 changed files
with
828 additions
and
9 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
File renamed without changes.
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
Oops, something went wrong.