mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(javascript): preserve uncertainty before lexical initialization (#12682)
* fix(javascript): preserve uncertainty before lexical initialization * fix(javascript): respect lexical declarator initialization order
This commit is contained in:
1 parent
8b60f3f25f
commit
ddd31b0289
6 files changed
+172
-32
No files matched your search
@@ -2705,6 +2705,78 @@ it.each([
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"let target before an initializer-free declaration",
|
||||
'let selected;const xs=[1,"one"];[fixed,selected]=xs;let fixed;',
|
||||
["1"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"let target declared by a later declarator in the same statement",
|
||||
'let selected;const xs=[1,"one"];let scratch=([fixed,selected]=xs),fixed;',
|
||||
["1"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"let target in its own initializer",
|
||||
'let selected;const xs=[1,"one"];let fixed=flag?([fixed,selected]=xs):0;',
|
||||
["1"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"let target in its own destructuring RHS",
|
||||
'let selected;const xs=[1,"one"];let [fixed]=([fixed,selected]=xs,[0]);',
|
||||
["1"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"let target initialized by an earlier declarator",
|
||||
'let selected;const xs=[1,"one"];let fixed,scratch=([fixed,selected]=xs);',
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"let target already initialized inside its binding pattern",
|
||||
'let selected;const xs=[1,"one"];let [fixed,scratch=([fixed,selected]=xs)]=[0];',
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"deferred initializer callable runs after its let initializes",
|
||||
'let fixed=()=>{let selected;const xs=[1,"one"];[fixed,selected]=xs;};fixed();',
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"let target before an initialized block declaration",
|
||||
'let selected;{const obj={fixed:1,mode:"one"};({fixed,mode:selected}=obj);let fixed=0;}',
|
||||
["mode"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"let target before the declaration on each loop entry",
|
||||
'let selected;while(next()){const xs=[1,"one"];[fixed,selected]=xs;let fixed;}',
|
||||
["1"],
|
||||
"candidate",
|
||||
],
|
||||
[
|
||||
"read before an uninitialized target",
|
||||
"let selected;let later;const xs=[1,2,3];[selected,fixed,later]=xs;let fixed;",
|
||||
["0"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"shadowed later let and initialized inner assignment target",
|
||||
'let selected;{let fixed;const xs=[1,"one"];[fixed,selected]=xs;}let fixed;',
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"deferred callable runs after initializing the outer let",
|
||||
'let selected;function read(){const xs=[1,"one"];[fixed,selected]=xs;}let fixed;read();',
|
||||
["1"],
|
||||
"resolved",
|
||||
],
|
||||
[
|
||||
"immutable lexical declaration",
|
||||
'const xs=[1,"one"];const [fixed,selected]=xs;xs[1]="later";',
|
||||
|
||||
Reference in new issue
Block a user