From 3a7e667f94d4575159b220748d58e781c30a50ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Mon, 9 May 2022 11:50:52 +0200 Subject: [PATCH 1/2] fix(jsii): deprecation warnings use this.constructor before calling super Instead of using `this.constructor`, inline the class name (which has the same value as `this.constructor` anyway). This removes what can be seen as a semantic issue (as it is usually illegal to refer to `this` before having called `super` in strict mode). --- packages/jsii/lib/transforms/deprecation-warnings.ts | 5 +---- packages/jsii/test/deprecation-warnings.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/jsii/lib/transforms/deprecation-warnings.ts b/packages/jsii/lib/transforms/deprecation-warnings.ts index 04775ddf91..a0a7b2f36a 100644 --- a/packages/jsii/lib/transforms/deprecation-warnings.ts +++ b/packages/jsii/lib/transforms/deprecation-warnings.ts @@ -530,10 +530,7 @@ class Transformer { node.body, insertStatements( node.body, - wrapWithRethrow( - statements, - ts.createPropertyAccess(ts.createThis(), 'constructor'), - ), + wrapWithRethrow(statements, node.parent.name!), ), ), ) as any; diff --git a/packages/jsii/test/deprecation-warnings.test.ts b/packages/jsii/test/deprecation-warnings.test.ts index cd62370f31..2262b4458e 100644 --- a/packages/jsii/test/deprecation-warnings.test.ts +++ b/packages/jsii/test/deprecation-warnings.test.ts @@ -656,7 +656,7 @@ describe('Call injections', () => { } catch (error) { if (process.env.JSII_DEBUG !== \\"1\\" && error.name === \\"DeprecationError\\") { - Error.captureStackTrace(error, this.constructor); + Error.captureStackTrace(error, Foo); } throw error; } } @@ -664,7 +664,7 @@ describe('Call injections', () => { exports.Foo = Foo; _a = JSII_RTTI_SYMBOL_1; Foo[_a] = { fqn: \\"testpkg.Foo\\", version: \\"0.0.1\\" }; - //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDSSxxQ0FBcUM7QUFDckMsTUFBYSxHQUFHO0lBQ2Q7Ozs7Ozs7O09BQWU7O0FBRGpCLGtCQUVDIiwic291cmNlc0NvbnRlbnQiOlsiXG4gICAgLyoqIEBkZXByZWNhdGVkIFVzZSBzb21ldGhpbmcgZWxzZSAqL1xuICAgIGV4cG9ydCBjbGFzcyBGb28ge1xuICAgICAgY29uc3RydWN0b3IoKXt9XG4gICAgfVxuICAiXX0=" + //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDSSxxQ0FBcUM7QUFDckMsTUFBYSxHQUFHO0lBQ2Q7Ozs7OzJDQURXLEdBQUc7OztPQUNDOztBQURqQixrQkFFQyIsInNvdXJjZXNDb250ZW50IjpbIlxuICAgIC8qKiBAZGVwcmVjYXRlZCBVc2Ugc29tZXRoaW5nIGVsc2UgKi9cbiAgICBleHBvcnQgY2xhc3MgRm9vIHtcbiAgICAgIGNvbnN0cnVjdG9yKCl7fVxuICAgIH1cbiAgIl19" `); }); }); From 75917392388d3d920e66bbcedc5fdc0ebd34014d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Mon, 9 May 2022 12:05:49 +0200 Subject: [PATCH 2/2] Add all-contributors info on bug report --- .all-contributorsrc | 9 +++++++++ README.md | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index ca64019365..44f3ee6556 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1384,6 +1384,15 @@ "contributions": [ "bug" ] + }, + { + "login": "3p3r", + "name": "Sepehr Laal", + "avatar_url": "https://avatars.githubusercontent.com/u/5657848?v=4", + "profile": "https://sepehrlaal.com/", + "contributions": [ + "bug" + ] } ], "repoType": "github", diff --git a/README.md b/README.md index 4d7272f5bf..5de4145a1d 100644 --- a/README.md +++ b/README.md @@ -192,46 +192,49 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Sam Goodwin

👀
Sebastian Korfmann

🐛 💻 🤔 +
Sepehr Laal

🐛
Shane Witbeck

🤔
Shiv Lakshminarayan

💻 🚧 👀
Somaya

💻 🤔 🚧 👀
The Gitter Badger

💻 🚧 -
Thomas Poignant

🐛 +
Thomas Poignant

🐛
Thomas Steinbach

🐛
Thorsten Hoeger

💻
Tim Wagner

🐛 🤔
Tobias Lidskog

💻
Ty Coghlan

🐛
Tyler van Hensbergen

🤔 -
Vlad Hrybok

🐛 +
Vlad Hrybok

🐛
Vladimir Shchur

🐛
Yan Zhulanow

💻
Yigong Liu

🐛 🤔
Zach Bienenfeld

🐛
ajnarang

🤔
aniljava

💻 -
arnogeurts-sqills

🐛 💻 +
arnogeurts-sqills

🐛 💻
deccy-mcc

🐛
dependabot-preview[bot]

🐛 🚧
dependabot[bot]

🚧
dheffx

🐛
gregswdl

🐛
guyroberts21

📖 -
mattBrzezinski

📖 +
mattBrzezinski

📖
mergify

🚧
mergify[bot]

🚧
nathannaveen

🚧
seiyashima42

🐛 💻 📖
sullis

💻
vaneek

🐛 + +
wendysophie

🐛