Commit 7497dbf
authored
Lua 5.0 support (#1263)
* feat: add flag for lua 5.0 target
* feat(5.0): implement spread arguments
* fix(5.0): in general, cases that apply to 5.1 should also apply to 5.0
* style: run prettier
* test(5.0): share the expected results of the obvious cases with 5.1
* feat(5.0): work around the missing '#' and '%' operators
* fix: log the correct lua version for unsupported features
* style: condense spread table if branch
* test: add a special case for modulo for 5.0
* style: fix indentation for test function snippet
* feat(5.0): implement spread element correctly
* fix: report correct lua version in bitops diagnostic message
* test: refactor spread tests to accomodate 5.0
* Revert "test: add a special case for modulo for 5.0"
This reverts commit fac16d2.
* test: test basic numeric expressions against all versions
* style: run prettier
* refactor: use the convenience function to make an unpack call
* style(lualib): use @noselfinfile for the modulo polyfill
* fix: make bundling compatible with lua 5.0
* fix(5.0): optimized single element array push for 5.0
* fix(5.0): fix constructor w/ instance fields for 5.0
* fix(lualib): count varargs correctly with lua 5.0
* fix(lualib): tracebacks don't support threads with lua 5.0
* fix(lualib): work around missing math.modf() in lua 5.0
* fix(lualib): work around missing string.match() in lua 5.0
* fix(lualib): detect lua 5.0 minor versions correctly
* refactor(lualib): lua 5.0 check can be a constant instead of a function
* fix(5.0): get json test library to load
* style: rename 5.0 json file
* style: use a better definition of infinity
* feat(5.0): don't transform infinity to math.huge, which doesn't exist in 5.0
* chore: bump lua-types version
* feat: build another copy of lualib for 5.0
* style: run prettier
* fix: small issues discovered in testing
* chore: bump lua-wasm-bindings version
* fix(lualib): select() call was not using vararg optimization, breaking some spead cases
* test: use inline lualib imports to get around problems with preloading the entire bundle
* test: remove old snapshots
* fix: json files can't contain comments
* Revert "fix: json files can't contain comments"
This reverts commit 581fb52.
Turns out they CAN contain comments, when they're named tsconfig.json!
* test: exclude lualib-lua50 from coverage
* style: move 5.0 tsconfig.json to existing lualib dir
* style: refactor lualib resolution into common function
* style: factor out table length transpilation into common function
* style: format 5.0 and non-5.0 require shims
* test: remove obsolete lua 5.0 arg test
* refactor(lualib): use builtins for the 5.0 branches instead of a version check
* refactor(lualib): move 5.0-specific to its own directory
* chore: add tsconfig to eslint
* refactor(lualib): reorganize dist/lualib directories to better support future targets
* fix(lualib): cache should account for multiple possible versions
* Revert "test: use inline lualib imports to get around problems with preloading the entire bundle"
This reverts commit 8d9ce98.
* chore: adjust jest and npm configs for new lualib structure
* refactor: cache lualib by file path so the universal target isn't cached several times
* chore: bump lua-types
* refactor: deduplicate require boilerplate
* refactor: simplify universal definition of TS_Match
* style: rename TS_Modulo -> TS_Modulo50
* refactor(lualib): use unpack helper to avoid code duplication in Generator.ts
* refactor(lualib): eliminate duplication in SourceMapTraceBack.ts
* chore(lualib): fix comment in CountVarargs.ts
* refactor(lualib): eliminate duplication in Error.ts
* fix(lualib): modules info should be cached per-target
* refactor(lualib): eliminate duplication in NumbertToString.ts
* refactor(lualib): modules info can also be cached by file path to avoid duplication
* style: for locating lualib features, it makes more sense to default to the universal target
* style: delete unnecessary noselfinfile
* chore: add 5.0 target to tsconfig schema1 parent 0d7e54b commit 7497dbf
File tree
67 files changed
+943
-457
lines changed- src
- lualib-build
- lualib
- 5.0
- universal
- transformation
- builtins
- utils
- visitors
- binary-expression
- class
- language-extensions
- transpilation
- test
- cli
- transpile
- unit
- __snapshots__
- builtins
- functions
- __snapshots__
- language-extensions
- __snapshots__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
67 files changed
+943
-457
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
547 | 560 | | |
548 | 561 | | |
549 | 562 | | |
| |||
581 | 594 | | |
582 | 595 | | |
583 | 596 | | |
584 | | - | |
| 597 | + | |
585 | 598 | | |
586 | 599 | | |
587 | 600 | | |
| 601 | + | |
588 | 602 | | |
589 | 603 | | |
590 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
49 | 52 | | |
| 53 | + | |
50 | 54 | | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
110 | 120 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | | - | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
121 | 131 | | |
122 | | - | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | | - | |
126 | | - | |
| 135 | + | |
| 136 | + | |
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
| |||
133 | 143 | | |
134 | 144 | | |
135 | 145 | | |
| 146 | + | |
136 | 147 | | |
137 | | - | |
| 148 | + | |
138 | 149 | | |
139 | 150 | | |
140 | 151 | | |
| |||
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
161 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
162 | 177 | | |
163 | 178 | | |
164 | | - | |
165 | | - | |
| 179 | + | |
| 180 | + | |
166 | 181 | | |
167 | 182 | | |
168 | 183 | | |
169 | 184 | | |
170 | 185 | | |
171 | 186 | | |
172 | | - | |
173 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
174 | 193 | | |
175 | 194 | | |
176 | 195 | | |
| |||
196 | 215 | | |
197 | 216 | | |
198 | 217 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
203 | 222 | | |
204 | 223 | | |
205 | | - | |
| 224 | + | |
206 | 225 | | |
207 | 226 | | |
208 | 227 | | |
209 | 228 | | |
210 | 229 | | |
211 | | - | |
| 230 | + | |
212 | 231 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
243 | | - | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
583 | 586 | | |
584 | 587 | | |
585 | 588 | | |
| 589 | + | |
| 590 | + | |
586 | 591 | | |
587 | 592 | | |
588 | 593 | | |
| |||
625 | 630 | | |
626 | 631 | | |
627 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
628 | 637 | | |
629 | 638 | | |
630 | 639 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
49 | 59 | | |
50 | | - | |
| 60 | + | |
| 61 | + | |
51 | 62 | | |
52 | 63 | | |
53 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments