Commit 3caa3e3
committed
[Performance Hints] Issue diagnostic for code wrapped in implicit nodes
In order to avoid issuing diagnostics for compiler-generate code, we ignore the
syntax subtree rooted at an implicit node. This causes our algorithm to miss
user code wrapped in implicit nodes during desugaring. For example, expressions
in implicit returns from single-expression closures and trailing closures are
completely ignored right now.
This change fixes heproblem by introducing a simple change to the AST walker.
Instead of ignoring the entire implicit-node subtree, we only ignore the
implicit node but continue to descend into its children. This enables our
algorithm to access non-implicit (user code) nodes nested inside
implicit (compiler-generated) nodes.1 parent d54f601 commit 3caa3e3
File tree
2 files changed
+26
-31
lines changed- lib/Sema
- test/PerformanceHints
2 files changed
+26
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 128 | | |
136 | | - | |
137 | | - | |
| 129 | + | |
| 130 | + | |
138 | 131 | | |
139 | 132 | | |
140 | 133 | | |
| |||
143 | 136 | | |
144 | 137 | | |
145 | 138 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 139 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 140 | + | |
| 141 | + | |
157 | 142 | | |
158 | 143 | | |
159 | 144 | | |
| |||
163 | 148 | | |
164 | 149 | | |
165 | 150 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 151 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 152 | + | |
| 153 | + | |
177 | 154 | | |
178 | 155 | | |
179 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
0 commit comments