Commit cb857a1
authored
Split apart ModelElement.from into a few pieces for cleaner code (#2265)
ModelElement.from was huge; it handles all types of elements, including
property-inducing ones. It handled verification, and element caching. This
changes splits it into 4 functions:
* ModelElement.fromPropertyInducingElement, a factory constructor.
* ModelElement.from, the sibling constructor for non-property-inducing
elements.
* ModelElement._from, a helper which performs the actual constructions.
* ModelElement._cacheNewModelElement, a helper which caches the newly
constructed ModelElement.
Callers frequently had conditional logic for property-inducing elements, so the
splitting of the constructor does not complicate callers, but allows them to be
explicit about which constructor they are calling.1 parent 3de1728 commit cb857a1
File tree
5 files changed
+208
-153
lines changed- lib/src/model
5 files changed
+208
-153
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | 143 | | |
| 144 | + | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
156 | | - | |
157 | | - | |
158 | | - | |
| 163 | + | |
159 | 164 | | |
160 | 165 | | |
161 | 166 | | |
| |||
504 | 509 | | |
505 | 510 | | |
506 | 511 | | |
507 | | - | |
| 512 | + | |
| 513 | + | |
508 | 514 | | |
509 | 515 | | |
510 | 516 | | |
| |||
0 commit comments