-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle block-level function declaration (#11801)
- Loading branch information
1 parent
ecbbd9d
commit 90fb8d2
Showing
9 changed files
with
108 additions
and
4 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
13 changes: 13 additions & 0 deletions
13
...plugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-const/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,13 @@ | ||
const run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
function run() { | ||
return true; | ||
} | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...lugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-const/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 @@ | ||
var run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
var _run = function () { | ||
return true; | ||
}; | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...l-plugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-let/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,13 @@ | ||
let run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
function run() { | ||
return true; | ||
} | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...-plugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-let/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 @@ | ||
var run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
var _run = function () { | ||
return true; | ||
}; | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...l-plugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-var/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,13 @@ | ||
var run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
function run() { | ||
return true; | ||
} | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...-plugin-transform-block-scoping/test/fixtures/general/issue-10046-collision-var/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 @@ | ||
var run = function () { | ||
return false; | ||
}; | ||
|
||
if (true) { | ||
var run = function () { | ||
return true; | ||
}; | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10046/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,9 @@ | ||
if (true) { | ||
function run() { | ||
return true; | ||
} | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10046/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,9 @@ | ||
if (true) { | ||
var run = function () { | ||
return true; | ||
}; | ||
} | ||
|
||
function test() { | ||
return run(); | ||
} |