Commit 9b851bf
committed
ASTScope: Collapse PureFunctionBodyScope and MethodBodyScope
This centralizes some invariants around the 'self' parameter.
While all ConstructorDecls and DestructorDecls have a 'self',
even if they're invalid because they're not nested inside a type,
we don't want to consider this as the base 'self' for lookups.
Eg, consider this invalid code:
class C {
func f() {
init() {
x
}
}
}
The base for the lookup should be f.self, not f.init.self.1 parent 9c4c959 commit 9b851bf
File tree
6 files changed
+19
-55
lines changed- include/swift/AST
- lib
- AST
- Sema
- test/NameLookup
6 files changed
+19
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1113 | 1113 | | |
1114 | 1114 | | |
1115 | 1115 | | |
1116 | | - | |
1117 | 1116 | | |
1118 | 1117 | | |
1119 | 1118 | | |
| |||
1128 | 1127 | | |
1129 | 1128 | | |
1130 | 1129 | | |
1131 | | - | |
1132 | | - | |
| 1130 | + | |
| 1131 | + | |
1133 | 1132 | | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
| 1133 | + | |
1146 | 1134 | | |
1147 | 1135 | | |
1148 | 1136 | | |
1149 | 1137 | | |
| 1138 | + | |
1150 | 1139 | | |
1151 | 1140 | | |
1152 | 1141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 121 | | |
136 | 122 | | |
137 | 123 | | |
| |||
218 | 204 | | |
219 | 205 | | |
220 | 206 | | |
221 | | - | |
222 | | - | |
| 207 | + | |
223 | 208 | | |
224 | 209 | | |
225 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | | - | |
1420 | | - | |
| 1419 | + | |
1421 | 1420 | | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | 1421 | | |
1426 | 1422 | | |
1427 | 1423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | | - | |
341 | 340 | | |
342 | 341 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | 342 | | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
354 | 347 | | |
355 | 348 | | |
356 | 349 | | |
| |||
361 | 354 | | |
362 | 355 | | |
363 | 356 | | |
| 357 | + | |
364 | 358 | | |
365 | 359 | | |
366 | 360 | | |
| |||
629 | 623 | | |
630 | 624 | | |
631 | 625 | | |
632 | | - | |
633 | | - | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
634 | 630 | | |
635 | 631 | | |
636 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
260 | | - | |
| 258 | + | |
261 | 259 | | |
262 | 260 | | |
263 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
0 commit comments