-
-
Notifications
You must be signed in to change notification settings - Fork 473
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): panic when the callee or member is…
… ParenthesisExpression or TS-syntax expressions.
- Loading branch information
Showing
10 changed files
with
102 additions
and
10 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
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
8 changes: 8 additions & 0 deletions
8
...n-transform-class-properties/test/fixtures/private-optional-member-with-sequence/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,8 @@ | ||
class A { | ||
static #a = 33; | ||
b = 44; | ||
method() { | ||
(undefined, this)?.#a; | ||
(undefined, this)?.b; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...-transform-class-properties/test/fixtures/private-optional-member-with-sequence/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,13 @@ | ||
class A { | ||
constructor() { | ||
babelHelpers.defineProperty(this, "b", 44); | ||
} | ||
method() { | ||
var _ref; | ||
(_ref = (undefined, this)) === null || _ref === void 0 ? void 0 : babelHelpers.assertClassBrand(A, _ref, _a)._; | ||
(undefined, this)?.b; | ||
} | ||
} | ||
var _a = { | ||
_: 33 | ||
}; |
9 changes: 9 additions & 0 deletions
9
...s/babel-plugin-transform-class-properties/test/fixtures/typescript/optional-call/input.ts
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,9 @@ | ||
class X { | ||
static #m = () => {}; | ||
method() { | ||
const o = { X }; | ||
(o.X as typeof X).#m(); | ||
o.X!.#m(); | ||
o.X.#m(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../babel-plugin-transform-class-properties/test/fixtures/typescript/optional-call/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,14 @@ | ||
class X { | ||
method() { | ||
var _o$X, _o$X2, _o$X3; | ||
const o = { | ||
X | ||
}; | ||
babelHelpers.assertClassBrand(X, _o$X = o.X, _m)._.call(_o$X); | ||
babelHelpers.assertClassBrand(X, _o$X2 = o.X, _m)._.call(_o$X2); | ||
babelHelpers.assertClassBrand(X, _o$X3 = o.X, _m)._.call(_o$X3); | ||
} | ||
} | ||
var _m = { | ||
_: () => {} | ||
}; |
9 changes: 9 additions & 0 deletions
9
...babel-plugin-transform-class-properties/test/fixtures/typescript/optional-member/input.ts
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,9 @@ | ||
class X { | ||
static #a = 0; | ||
method() { | ||
const o = { X }; | ||
(o.X as typeof X).#a; | ||
o.X!.#a; | ||
o.X.#a; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...abel-plugin-transform-class-properties/test/fixtures/typescript/optional-member/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,13 @@ | ||
class X { | ||
method() { | ||
const o = { | ||
X | ||
}; | ||
babelHelpers.assertClassBrand(X, o.X, _a)._; | ||
babelHelpers.assertClassBrand(X, o.X, _a)._; | ||
babelHelpers.assertClassBrand(X, o.X, _a)._; | ||
} | ||
} | ||
var _a = { | ||
_: 0 | ||
}; |
3 changes: 3 additions & 0 deletions
3
...mance/tests/babel-plugin-transform-class-properties/test/fixtures/typescript/options.json
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,3 @@ | ||
{ | ||
"plugins": ["transform-class-properties", "transform-typescript"] | ||
} |