-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/class-properties): make
_super
function outside cla…
…ss strict mode (#7708) When create a `_super` function outside class, ensure it's always strict mode. The code it contains was previously inside the class, so was strict mode.
- Loading branch information
1 parent
5fd1361
commit de5b0b6
Showing
8 changed files
with
65 additions
and
14 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
1 change: 1 addition & 0 deletions
1
...m-class-properties/test/fixtures/public/derived-super-in-default-params-complex/output.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let _super = function() { | ||
"use strict"; | ||
babelHelpers.defineProperty(this, "bar", "foo"); | ||
return this; | ||
}; | ||
|
1 change: 1 addition & 0 deletions
1
...-class-properties/test/fixtures/public/derived-super-in-default-params-in-arrow/output.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let _super = function() { | ||
"use strict"; | ||
babelHelpers.defineProperty(this, "bar", "foo"); | ||
return this; | ||
}; | ||
|
1 change: 1 addition & 0 deletions
1
...transform-class-properties/test/fixtures/public/derived-super-in-default-params/output.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let _super = function() { | ||
"use strict"; | ||
babelHelpers.defineProperty(this, "bar", "foo"); | ||
return this; | ||
}; | ||
|
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
14 changes: 14 additions & 0 deletions
14
...abel-plugin-transform-class-properties/test/fixtures/super-in-constructor-strict/input.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,14 @@ | ||
function sloppy() { | ||
class C extends S { | ||
prop = 1; | ||
constructor(x = super()) {} | ||
} | ||
} | ||
|
||
function strict() { | ||
"use strict"; | ||
class C extends S { | ||
prop = 1; | ||
constructor(x = super()) {} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...bel-plugin-transform-class-properties/test/fixtures/super-in-constructor-strict/output.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,21 @@ | ||
function sloppy() { | ||
let _super = function() { | ||
"use strict"; | ||
babelHelpers.defineProperty(this, "prop", 1); | ||
return this; | ||
}; | ||
class C extends S { | ||
constructor(x = _super.call(super())) {} | ||
} | ||
} | ||
|
||
function strict() { | ||
"use strict"; | ||
let _super2 = function() { | ||
babelHelpers.defineProperty(this, "prop", 1); | ||
return this; | ||
}; | ||
class C extends S { | ||
constructor(x = _super2.call(super())) {} | ||
} | ||
} |