Commit 313e6ea
authored
Hoisting (#369)
* initial hoisting implementation (needs tests)
* fixed issues with switch and loop continue
* dealing with hoisting of imports and exports
* hoisting tests
* fixed namespace hoisting and added more tests
* rebuilt translation tests with hoisting
* fixed tests
* More Hoisting Adjustments
- pushing scope for try/catch/finally
- some refactoring and commenting
- fixed more tests
* reverting accidentally changed test files
* renamed some things for clarity
* working on possible smart-hoisting detection
* addressed comments
* smart-hoisting working
* fixed tests
* refactored hoisting detection and added command line options to control hoisting
* Another full refactor
- checking variables for reference-before-declaration when they are first seen to avoid scanning later
- caching nested functions in scope to avoid repeat scan later
- added error for attempting to hoist when hoisting is off since it's easy to detect now
- added tests for hoisting errors
* change ScopeType to bitfields
* rewrote hoisting to defer all logic to popScope, so that there's no need for additional scanning
* reworked hoisting to avoid printer hacks
* removing unnecessary symbol lookups
* removing accidentally added import
* replaced ts.Symbol stored in identifiers with generic ids
* split out stuff to separate functions
* reverted bad logic which broke referencing exports inside functions1 parent 661d5b0 commit 313e6ea
File tree
25 files changed
+726
-137
lines changed- src
- test
- src
- translation/lua
- unit
- compiler/configuration
- mixed
25 files changed
+726
-137
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
791 | 793 | | |
792 | 794 | | |
793 | 795 | | |
| 796 | + | |
794 | 797 | | |
795 | 798 | | |
796 | 799 | | |
797 | 800 | | |
798 | 801 | | |
799 | 802 | | |
800 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
801 | 810 | | |
802 | 811 | | |
| 812 | + | |
803 | 813 | | |
804 | 814 | | |
805 | 815 | | |
| |||
0 commit comments