Commit a71323b
authored
Private Name Support in the Checker (#5)
* begin update checker for private names
- [x] treat private names as unique:
- case 1: cannot say that a variable is of a class type unless the variable points to an instance of the class
- see [test](https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNamesUnique.ts)
- case 2: private names in class hierarchies do not conflict
- see [test](https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNamesNoConflictWhenInheriting.ts)
- [x] `#constructor` is reserved
- see [test](https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNameConstructorReserved.ts)
- check in `bindWorker`, where every node is visited
- [x] Accessibility modifiers can't be used with private names
- see [test](https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNamesNoAccessibilityModifiers.ts)
- implemented in `checkAccessibilityModifiers`, using `ModifierFlags.AccessibilityModifier`
- [x] `delete #foo` not allowed
- [x] Private name accesses not allowed outside of the defining class
- see test: https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNameNotAccessibleOutsideDefiningClass.ts
- see [test](https://github.com/mheiber/TypeScript/tree/checker/tests/cases/conformance/classes/members/privateNames/privateNamesNoDelete.ts)
- implemented in `checkDeleteExpression`
- [x] Do [the right thing](https://gist.github.com/mheiber/b6fc7adb426c2e1cdaceb5d7786fc630) for nested classes
for private name support in the checker:
- make names more consistent
- remove unnecessary checks
- add utility function to public API
- other small cleanup
for consistency with other calculation of
special property names (starting with __),
move the calculation of property names for
unique es symbols to `utilities.ts`.
Update private name tests to use 'strict'
type checking and to target es6 instead of
default. Makes the js output easier to read
and tests more surface area with other
checker features.
Signed-off-by: Max Heiber <[email protected]>1 parent d33c72c commit a71323b
File tree
128 files changed
+3239
-44
lines changed- src/compiler
- tests
- baselines/reference
- api
- cases/conformance/classes/members/privateNames
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
128 files changed
+3239
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
276 | 283 | | |
277 | 284 | | |
278 | 285 | | |
| |||
330 | 337 | | |
331 | 338 | | |
332 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
333 | 344 | | |
334 | 345 | | |
335 | 346 | | |
| |||
382 | 393 | | |
383 | 394 | | |
384 | 395 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | 396 | | |
391 | 397 | | |
392 | 398 | | |
| |||
1802 | 1808 | | |
1803 | 1809 | | |
1804 | 1810 | | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
1805 | 1823 | | |
1806 | 1824 | | |
1807 | 1825 | | |
| |||
2074 | 2092 | | |
2075 | 2093 | | |
2076 | 2094 | | |
| 2095 | + | |
| 2096 | + | |
2077 | 2097 | | |
2078 | 2098 | | |
2079 | 2099 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
1572 | 1573 | | |
1573 | 1574 | | |
1574 | 1575 | | |
1575 | | - | |
1576 | | - | |
| 1576 | + | |
| 1577 | + | |
1577 | 1578 | | |
1578 | 1579 | | |
1579 | 1580 | | |
| |||
2679 | 2680 | | |
2680 | 2681 | | |
2681 | 2682 | | |
2682 | | - | |
2683 | | - | |
| 2683 | + | |
| 2684 | + | |
2684 | 2685 | | |
2685 | | - | |
| 2686 | + | |
2686 | 2687 | | |
2687 | 2688 | | |
2688 | 2689 | | |
2689 | 2690 | | |
2690 | | - | |
| 2691 | + | |
| 2692 | + | |
2691 | 2693 | | |
2692 | 2694 | | |
2693 | 2695 | | |
| |||
6250 | 6252 | | |
6251 | 6253 | | |
6252 | 6254 | | |
6253 | | - | |
| 6255 | + | |
6254 | 6256 | | |
6255 | 6257 | | |
6256 | 6258 | | |
| |||
9258 | 9260 | | |
9259 | 9261 | | |
9260 | 9262 | | |
9261 | | - | |
| 9263 | + | |
| 9264 | + | |
| 9265 | + | |
9262 | 9266 | | |
9263 | 9267 | | |
9264 | 9268 | | |
| |||
12205 | 12209 | | |
12206 | 12210 | | |
12207 | 12211 | | |
12208 | | - | |
| 12212 | + | |
| 12213 | + | |
| 12214 | + | |
| 12215 | + | |
| 12216 | + | |
| 12217 | + | |
| 12218 | + | |
| 12219 | + | |
| 12220 | + | |
| 12221 | + | |
| 12222 | + | |
| 12223 | + | |
| 12224 | + | |
| 12225 | + | |
| 12226 | + | |
| 12227 | + | |
| 12228 | + | |
| 12229 | + | |
| 12230 | + | |
| 12231 | + | |
| 12232 | + | |
| 12233 | + | |
12209 | 12234 | | |
12210 | 12235 | | |
12211 | 12236 | | |
| |||
18423 | 18448 | | |
18424 | 18449 | | |
18425 | 18450 | | |
| 18451 | + | |
| 18452 | + | |
| 18453 | + | |
| 18454 | + | |
| 18455 | + | |
| 18456 | + | |
| 18457 | + | |
| 18458 | + | |
| 18459 | + | |
| 18460 | + | |
| 18461 | + | |
| 18462 | + | |
| 18463 | + | |
| 18464 | + | |
| 18465 | + | |
| 18466 | + | |
| 18467 | + | |
| 18468 | + | |
| 18469 | + | |
| 18470 | + | |
| 18471 | + | |
| 18472 | + | |
| 18473 | + | |
| 18474 | + | |
| 18475 | + | |
| 18476 | + | |
| 18477 | + | |
| 18478 | + | |
| 18479 | + | |
| 18480 | + | |
| 18481 | + | |
| 18482 | + | |
| 18483 | + | |
| 18484 | + | |
| 18485 | + | |
| 18486 | + | |
| 18487 | + | |
| 18488 | + | |
| 18489 | + | |
| 18490 | + | |
| 18491 | + | |
| 18492 | + | |
18426 | 18493 | | |
18427 | 18494 | | |
18428 | 18495 | | |
| |||
18435 | 18502 | | |
18436 | 18503 | | |
18437 | 18504 | | |
18438 | | - | |
| 18505 | + | |
18439 | 18506 | | |
18440 | 18507 | | |
18441 | 18508 | | |
| |||
21376 | 21443 | | |
21377 | 21444 | | |
21378 | 21445 | | |
| 21446 | + | |
| 21447 | + | |
| 21448 | + | |
21379 | 21449 | | |
21380 | 21450 | | |
21381 | 21451 | | |
| |||
22529 | 22599 | | |
22530 | 22600 | | |
22531 | 22601 | | |
22532 | | - | |
22533 | | - | |
22534 | | - | |
22535 | 22602 | | |
22536 | 22603 | | |
22537 | 22604 | | |
| |||
29210 | 29277 | | |
29211 | 29278 | | |
29212 | 29279 | | |
| 29280 | + | |
| 29281 | + | |
| 29282 | + | |
29213 | 29283 | | |
29214 | 29284 | | |
29215 | 29285 | | |
| |||
29611 | 29681 | | |
29612 | 29682 | | |
29613 | 29683 | | |
| 29684 | + | |
| 29685 | + | |
| 29686 | + | |
| 29687 | + | |
29614 | 29688 | | |
29615 | 29689 | | |
29616 | 29690 | | |
| |||
30035 | 30109 | | |
30036 | 30110 | | |
30037 | 30111 | | |
30038 | | - | |
30039 | | - | |
30040 | | - | |
30041 | | - | |
30042 | 30112 | | |
30043 | 30113 | | |
30044 | 30114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4299 | 4299 | | |
4300 | 4300 | | |
4301 | 4301 | | |
4302 | | - | |
| 4302 | + | |
4303 | 4303 | | |
4304 | 4304 | | |
4305 | 4305 | | |
4306 | | - | |
| 4306 | + | |
4307 | 4307 | | |
4308 | 4308 | | |
4309 | 4309 | | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
| 4329 | + | |
4310 | 4330 | | |
4311 | 4331 | | |
4312 | 4332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3026 | 3026 | | |
3027 | 3027 | | |
3028 | 3028 | | |
| 3029 | + | |
3029 | 3030 | | |
3030 | 3031 | | |
3031 | 3032 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2728 | 2728 | | |
2729 | 2729 | | |
2730 | 2730 | | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
2731 | 2735 | | |
2732 | 2736 | | |
2733 | 2737 | | |
2734 | 2738 | | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
2735 | 2743 | | |
2736 | 2744 | | |
2737 | 2745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1876 | 1876 | | |
1877 | 1877 | | |
1878 | 1878 | | |
| 1879 | + | |
1879 | 1880 | | |
1880 | 1881 | | |
1881 | 1882 | | |
| |||
0 commit comments