-
-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(commonjs): preserve
this
reference in the child class (#1537)
* fix(commonjs): preserve this reference in the child class * update snapshots * tweak Co-authored-by: Dasa Paddock <[email protected]> * test: update snapshots --------- Co-authored-by: Dasa Paddock <[email protected]>
- Loading branch information
Showing
8 changed files
with
146 additions
and
169 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
2 changes: 2 additions & 0 deletions
2
packages/commonjs/test/fixtures/function/preserv-this-reference-in-the-child-class/dep.js
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,2 @@ | ||
function Dep(){}; | ||
export default Dep; |
11 changes: 11 additions & 0 deletions
11
packages/commonjs/test/fixtures/function/preserv-this-reference-in-the-child-class/main.js
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,11 @@ | ||
const Dep = require('./dep'); | ||
|
||
class Main extends Dep { | ||
constructor() { | ||
super(); | ||
this.name = this.constructor.name; | ||
} | ||
static name = "main"; | ||
} | ||
|
||
t.is(new Main().name, "main"); |
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
Binary file not shown.
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
Binary file not shown.
Oops, something went wrong.