forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle redeclared private field in computed key
- Loading branch information
1 parent
27a09f1
commit 3a673dc
Showing
9 changed files
with
228 additions
and
3 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
14 changes: 14 additions & 0 deletions
14
...al-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/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 @@ | ||
class Foo { | ||
#foo = 1; | ||
|
||
test() { | ||
class Nested { | ||
#foo = 2; | ||
|
||
[this.#foo]() { | ||
} | ||
} | ||
|
||
this.#foo; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...l-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/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,43 @@ | ||
var Foo = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _foo, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "test", | ||
value: function test() { | ||
var _babelHelpers$classPr; | ||
|
||
_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo2)[_foo2]; | ||
|
||
var Nested = /*#__PURE__*/function () { | ||
function Nested() { | ||
babelHelpers.classCallCheck(this, Nested); | ||
Object.defineProperty(this, _foo2, { | ||
writable: true, | ||
value: 2 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Nested, [{ | ||
key: _babelHelpers$classPr, | ||
value: function () {} | ||
}]); | ||
return Nested; | ||
}(); | ||
|
||
var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); | ||
|
||
babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); |
12 changes: 12 additions & 0 deletions
12
...ugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/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,12 @@ | ||
class Foo { | ||
#foo = 1; | ||
|
||
test() { | ||
class Nested { | ||
[this.#foo]() { | ||
} | ||
} | ||
|
||
this.#foo; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...gin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/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,35 @@ | ||
var Foo = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _foo, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "test", | ||
value: function test() { | ||
var _this = this; | ||
|
||
var Nested = /*#__PURE__*/function () { | ||
function Nested() { | ||
babelHelpers.classCallCheck(this, Nested); | ||
} | ||
|
||
babelHelpers.createClass(Nested, [{ | ||
key: babelHelpers.classPrivateFieldLooseBase(_this, _foo)[_foo], | ||
value: function () {} | ||
}]); | ||
return Nested; | ||
}(); | ||
|
||
babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); |
14 changes: 14 additions & 0 deletions
14
...proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/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 @@ | ||
class Foo { | ||
#foo = 1; | ||
|
||
test() { | ||
class Nested { | ||
#foo = 2; | ||
|
||
[this.#foo]() { | ||
} | ||
} | ||
|
||
this.#foo; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...roposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/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,45 @@ | ||
var Foo = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
_foo.set(this, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "test", | ||
value: function test() { | ||
var _babelHelpers$classPr; | ||
|
||
_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo2); | ||
|
||
var Nested = /*#__PURE__*/function () { | ||
function Nested() { | ||
babelHelpers.classCallCheck(this, Nested); | ||
|
||
_foo2.set(this, { | ||
writable: true, | ||
value: 2 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Nested, [{ | ||
key: _babelHelpers$classPr, | ||
value: function () {} | ||
}]); | ||
return Nested; | ||
}(); | ||
|
||
var _foo2 = new WeakMap(); | ||
|
||
babelHelpers.classPrivateFieldGet(this, _foo); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
var _foo = new WeakMap(); |
12 changes: 12 additions & 0 deletions
12
...bel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/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,12 @@ | ||
class Foo { | ||
#foo = 1; | ||
|
||
test() { | ||
class Nested { | ||
[this.#foo]() { | ||
} | ||
} | ||
|
||
this.#foo; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...el-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/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,36 @@ | ||
var Foo = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
_foo.set(this, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "test", | ||
value: function test() { | ||
var _this = this; | ||
|
||
var Nested = /*#__PURE__*/function () { | ||
function Nested() { | ||
babelHelpers.classCallCheck(this, Nested); | ||
} | ||
|
||
babelHelpers.createClass(Nested, [{ | ||
key: babelHelpers.classPrivateFieldGet(_this, _foo), | ||
value: function () {} | ||
}]); | ||
return Nested; | ||
}(); | ||
|
||
babelHelpers.classPrivateFieldGet(this, _foo); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
var _foo = new WeakMap(); |