-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(es/compat): Handle private names from class properties pass #8090
Merged
Merged
Changes from all commits
Commits
Show all changes
107 commits
Select commit
Hold shift + click to select a range
b9de617
Add a test
kdy1 a7808e2
Add a test
kdy1 3b00983
fix
kdy1 fbc39b7
Update test refs
kdy1 b873c49
Add a pass
kdy1 5a1dc54
Add a test
kdy1 c13fbe9
Add a test, really
kdy1 f1c0f9c
Delete crates/swc/tests/fixture/issues-7xxx/7561/input/.swcrc
kdy1 82f0173
Update test refs
kdy1 4e0586d
fixture
kdy1 c5d517d
Update test refs
kdy1 7fe67d4
Revert "Delete crates/swc/tests/fixture/issues-7xxx/7561/input/.swcrc"
kdy1 118e4e0
Add tests
kdy1 25216c8
Add a test
kdy1 8cfb7a1
Update test refs
kdy1 137dbf3
Remove wrong
kdy1 150d1f0
WIP
kdy1 14ddb32
more match
kdy1 6e6207e
assert
kdy1 7c1c89a
Oh
kdy1 b68d2c6
some work
kdy1 1eb17c9
Copy opt chain
kdy1 15bb443
,unresolved_mark
kdy1 778e4ed
,unresolved_mark
kdy1 b4ae3f4
opt chain
kdy1 8d57935
Well
kdy1 f7a5db5
trivial refactor
kdy1 6318227
take_vars
kdy1 f918b4f
Not a public api
kdy1 ca9581d
One impl
kdy1 aec9fd9
assert
kdy1 78fb659
Remove needless code
kdy1 8780fa7
Fix some tests
kdy1 607a873
Fix some tests
kdy1 2f5ae42
Fix some tests
kdy1 54cf3ce
Fix some tests
kdy1 8fdd12b
Fix some tests
kdy1 7b855c2
Fix some tests
kdy1 1298ae5
Fix some tests
kdy1 f770713
Fix some tests
kdy1 f5e1c3d
Fix some tests
kdy1 ce527f8
Fix some tests
kdy1 39bd773
Fix some tests
kdy1 271fbb9
Fix some tests
kdy1 eee04dc
Fix some tests
kdy1 645e0c0
Fix some tests
kdy1 bcccedb
Fix some tests
kdy1 9654e72
Rename
kdy1 8e0aaf1
Rename
kdy1 7b79570
Fix some tests
kdy1 cea1f9c
Fix some tests
kdy1 2c77b21
Fix some tests
kdy1 ab5b779
Fix some tests
kdy1 67e9f35
Fix some tests
kdy1 2c50746
Fix some tests
kdy1 b805cf2
Fix some tests
kdy1 2fb2904
Fix some tests
kdy1 5d61615
Fix some tests
kdy1 ba3c276
Fix some tests
kdy1 42aa106
Fix some tests
kdy1 bf315b9
Fix some tests
kdy1 ce7d526
Fix some tests
kdy1 a286965
Fix some tests
kdy1 84f6afc
Fix some tests
kdy1 27612bb
Fix some tests
kdy1 5a09807
Fix some tests
kdy1 e99057d
Fix some tests
kdy1 44c51ab
Fix some tests
kdy1 ca8fab5
Fix some tests
kdy1 6f80161
Fix some tests
kdy1 5400f4c
Fix some tests
kdy1 ebe7480
let unresolved_mark = Mark::new();
kdy1 2679043
let unresolved_mark = Mark::new();
kdy1 2d543cb
let unresolved_mark = Mark::new();
kdy1 bc79073
Fix `swc`
kdy1 221d92c
let unresolved_mark = Mark::new();
kdy1 7906671
let unresolved_mark = Mark::new();
kdy1 9bb49a8
let unresolved_mark = Mark::new();
kdy1 7771b7b
Fix more
kdy1 dd2783b
Fix more
kdy1 a10084d
loose
kdy1 ec30e27
loose
kdy1 361e9ef
Update test refs
kdy1 58563b9
Update test refs
kdy1 014425b
no regression
kdy1 6a4da37
Update test refs
kdy1 7772e14
Fix more
kdy1 a708e7b
Fix more
kdy1 a88ea3d
Fix more
kdy1 1e57f4c
Fix more
kdy1 72be99a
Fix more
kdy1 1422a53
Fix more
kdy1 ad6c14b
Fix more
kdy1 df04e7f
Fix more
kdy1 efecbd3
Fix more
kdy1 419cf09
Update test refs
kdy1 85da7f5
Update test refs
kdy1 3013d85
Update test refs
kdy1 e198f2d
Add a test
kdy1 7c2071f
Change order
kdy1 a05a045
`this` to opt chain
kdy1 f433157
Update test refs
kdy1 76c85cb
Update test refs
kdy1 721d78a
`is_private_access`
kdy1 d8cbdb1
Update test refs
kdy1 dcc3aa9
Merge branch 'main' into issue-7561
kdy1 fb3ddbd
Merge branch 'main' into issue-7561
swc-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
19 changes: 19 additions & 0 deletions
19
crates/swc/tests/fixture/issues-7xxx/7561/es2019/input/.swcrc
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,19 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2019", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": false, | ||
"isModule": false | ||
} |
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,7 @@ | ||
class Foo { | ||
#x; | ||
|
||
test() { | ||
this?.y.#x | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
crates/swc/tests/fixture/issues-7xxx/7561/es2019/output/1.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,15 @@ | ||
var _class_private_field_get = require("@swc/helpers/_/_class_private_field_get"); | ||
var _class_private_field_init = require("@swc/helpers/_/_class_private_field_init"); | ||
var _x = /*#__PURE__*/ new WeakMap(); | ||
class Foo { | ||
test() { | ||
var _this, _this_y; | ||
(_this = this) === null || _this === void 0 ? void 0 : _class_private_field_get._(_this_y = _this.y, _x); | ||
} | ||
constructor(){ | ||
_class_private_field_init._(this, _x, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
crates/swc/tests/fixture/issues-7xxx/7561/es2021/input/.swcrc
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,19 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2021", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": false, | ||
"isModule": false | ||
} |
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,7 @@ | ||
class Foo { | ||
#x; | ||
|
||
test() { | ||
this?.y.#x | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
crates/swc/tests/fixture/issues-7xxx/7561/es2021/output/1.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,15 @@ | ||
var _class_private_field_get = require("@swc/helpers/_/_class_private_field_get"); | ||
var _class_private_field_init = require("@swc/helpers/_/_class_private_field_init"); | ||
var _x = /*#__PURE__*/ new WeakMap(); | ||
class Foo { | ||
test() { | ||
var _this, _this_y; | ||
(_this = this) === null || _this === void 0 ? void 0 : _class_private_field_get._(_this_y = _this.y, _x); | ||
} | ||
constructor(){ | ||
_class_private_field_init._(this, _x, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
crates/swc/tests/fixture/issues-7xxx/7561/es2022/input/.swcrc
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,19 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": false, | ||
"isModule": false | ||
} |
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,7 @@ | ||
class Foo { | ||
#x; | ||
|
||
test() { | ||
this?.y.#x | ||
} | ||
} |
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,6 @@ | ||
class Foo { | ||
#x; | ||
test() { | ||
this?.y.#x; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,10 +5,9 @@ import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_fie | |
var _fieldFunc = /*#__PURE__*/ new WeakMap(), _fieldFunc2 = /*#__PURE__*/ new WeakMap(); | ||
class A { | ||
test() { | ||
var _class_private_field_get1; | ||
var _this_getInstance; | ||
var _this, _this1, _ref, _this_getInstance; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous output seems wrong |
||
_class_private_field_get(this, _fieldFunc).call(this); | ||
(_class_private_field_get1 = _class_private_field_get(this, _fieldFunc)) === null || _class_private_field_get1 === void 0 ? void 0 : _class_private_field_get1.call(this); | ||
(_this = _class_private_field_get(_ref = _this1 = this, _fieldFunc)) === null || _this === void 0 ? void 0 : _this.call(_this1); | ||
const func = _class_private_field_get(this, _fieldFunc); | ||
func(); | ||
new (_class_private_field_get(this, _fieldFunc))(); | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jridgewell But let's fix correctness issues first.