Commit b144126
fix(core): inject migration: replace param with this. (#60713)
The inject tool inserts `const foo = this.foo` if code
in the constructor referenced the constructor parameter `foo`.
If `foo` is a readonly property, we can instead replace `foo` with
`this.foo`. This allows more properties to be moved out of the
constructor with combineMemberInitializers.
For now, it only touches initializers, not all of the code in the
constructor.
PR Close #607131 parent 77c6041 commit b144126Copy full SHA for b144126
File tree
Expand file treeCollapse file tree
4 files changed
+355
-51
lines changedOpen diff view settings
Filter options
- packages/core/schematics
- ng-generate/inject-migration
- test
Expand file treeCollapse file tree
4 files changed
+355
-51
lines changedOpen diff view settings
Collapse file
packages/core/schematics/ng-generate/inject-migration/analysis.ts
Copy file name to clipboardExpand all lines: packages/core/schematics/ng-generate/inject-migration/analysis.ts+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
40 | 40 | |
41 | 41 | |
42 | 42 | |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
43 | 64 | |
44 | 65 | |
45 | 66 | |
|
Collapse file
packages/core/schematics/ng-generate/inject-migration/internal.ts
Copy file name to clipboardExpand all lines: packages/core/schematics/ng-generate/inject-migration/internal.ts+95-2Lines changed: 95 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | | - |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
11 | 16 | |
12 | 17 | |
13 | 18 | |
| ||
40 | 45 | |
41 | 46 | |
42 | 47 | |
| 48 | + |
43 | 49 | |
44 | 50 | |
45 | 51 | |
| ||
67 | 73 | |
68 | 74 | |
69 | 75 | |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
70 | 80 | |
71 | 81 | |
72 | 82 | |
73 | 83 | |
74 | | - |
| 84 | + |
75 | 85 | |
76 | 86 | |
77 | 87 | |
| ||
230 | 240 | |
231 | 241 | |
232 | 242 | |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
| 256 | + |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | + |
| 261 | + |
| 262 | + |
| 263 | + |
| 264 | + |
| 265 | + |
| 266 | + |
| 267 | + |
| 268 | + |
| 269 | + |
| 270 | + |
| 271 | + |
| 272 | + |
| 273 | + |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | + |
| 278 | + |
| 279 | + |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | + |
| 286 | + |
| 287 | + |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | + |
| 295 | + |
| 296 | + |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
233 | 324 | |
234 | 325 | |
235 | 326 | |
| ||
239 | 330 | |
240 | 331 | |
241 | 332 | |
| 333 | + |
242 | 334 | |
243 | 335 | |
244 | 336 | |
| ||
265 | 357 | |
266 | 358 | |
267 | 359 | |
| 360 | + |
268 | 361 | |
269 | 362 | |
270 | 363 | |
|
Collapse file
packages/core/schematics/ng-generate/inject-migration/migration.ts
Copy file name to clipboardExpand all lines: packages/core/schematics/ng-generate/inject-migration/migration.ts+74-24Lines changed: 74 additions & 24 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
71 | 71 | |
72 | 72 | |
73 | 73 | |
| 74 | + |
74 | 75 | |
75 | 76 | |
76 | 77 | |
| ||
755 | 756 | |
756 | 757 | |
757 | 758 | |
| 759 | + |
758 | 760 | |
759 | | - |
| 761 | + |
760 | 762 | |
761 | 763 | |
762 | 764 | |
| ||
774 | 776 | |
775 | 777 | |
776 | 778 | |
| 779 | + |
| 780 | + |
| 781 | + |
| 782 | + |
| 783 | + |
| 784 | + |
| 785 | + |
| 786 | + |
| 787 | + |
| 788 | + |
| 789 | + |
| 790 | + |
| 791 | + |
| 792 | + |
| 793 | + |
| 794 | + |
| 795 | + |
| 796 | + |
| 797 | + |
| 798 | + |
| 799 | + |
| 800 | + |
| 801 | + |
| 802 | + |
| 803 | + |
| 804 | + |
777 | 805 | |
778 | 806 | |
779 | 807 | |
780 | | - |
781 | | - |
782 | | - |
783 | | - |
784 | | - |
785 | | - |
786 | | - |
787 | | - |
788 | | - |
789 | 808 | |
790 | 809 | |
791 | | - |
792 | | - |
793 | | - |
794 | | - |
| 810 | + |
795 | 811 | |
796 | | - |
797 | | - |
798 | | - |
799 | | - |
800 | | - |
801 | | - |
802 | | - |
803 | | - |
| 812 | + |
| 813 | + |
| 814 | + |
| 815 | + |
| 816 | + |
| 817 | + |
804 | 818 | |
805 | | - |
806 | | - |
807 | 819 | |
808 | 820 | |
809 | 821 | |
| ||
826 | 838 | |
827 | 839 | |
828 | 840 | |
| 841 | + |
| 842 | + |
| 843 | + |
| 844 | + |
| 845 | + |
| 846 | + |
| 847 | + |
| 848 | + |
| 849 | + |
| 850 | + |
| 851 | + |
| 852 | + |
| 853 | + |
| 854 | + |
| 855 | + |
| 856 | + |
| 857 | + |
| 858 | + |
| 859 | + |
| 860 | + |
| 861 | + |
| 862 | + |
| 863 | + |
| 864 | + |
| 865 | + |
| 866 | + |
| 867 | + |
| 868 | + |
| 869 | + |
| 870 | + |
| 871 | + |
| 872 | + |
| 873 | + |
| 874 | + |
| 875 | + |
| 876 | + |
| 877 | + |
| 878 | + |
0 commit comments