forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pathCache in
NodePath#_replaceWith
(babel#12391)
* add tests on regression 12386 * fix: update cache on _replaceWith * fix: pathCache in replaceWithMultiple could be nullish * Update packages/babel-traverse/src/path/replacement.js Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * test: add replaceWith test to traverse Co-authored-by: Brian Ng <bng412@gmail.com> Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
433d007
commit 332ed0a
Showing
6 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...ansform-typescript/test/fixtures/variable-declaration/non-null-in-optional-chain/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,2 @@ | ||
const a = 1; | ||
const b = () => a?.b?.c!.d; |
3 changes: 3 additions & 0 deletions
3
...orm-typescript/test/fixtures/variable-declaration/non-null-in-optional-chain/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-typescript", "proposal-optional-chaining"] | ||
} |
7 changes: 7 additions & 0 deletions
7
...nsform-typescript/test/fixtures/variable-declaration/non-null-in-optional-chain/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,7 @@ | ||
const a = 1; | ||
|
||
const b = () => { | ||
var _a$b; | ||
|
||
return a === null || a === void 0 ? void 0 : (_a$b = a.b) === null || _a$b === void 0 ? void 0 : _a$b.c.d; | ||
}; |
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