You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: failure on anonymous class with a method (#1824)
`jsii` used to fail when trying to generate deprecation warnings and
given a statement like this:
```ts
export function propertyInjectionDecorator<T extends Constructor>(ctr: T) {
// Important for the bug: the anonymous class extends something, *and*
// declares a method.
return class extends ctr {
public someMethod(): string {
return 'abc';
}
};
}
```
The reason is that during generation of deprecation warnings we iterate
over all classes and methods (both exported and unexported), and
generate a symbol identifier for every method; but this class is
anonymous
so it doesn't have a symbol, and generating the identifier fails with
the error:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at symbolIdentifier (.../jsii/lib/common/symbol-id.js:40:17)
```
Handle this by handling the case where we don't have a symbol
and returning `undefined`.
Fixesaws/aws-cdk#33213
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].
[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
---------
Co-authored-by: Eli Polonsky <Eli.polonsky@gmail.com>
0 commit comments