Commit 539db62
committed
Checker: cfg-gate: detect enclosing block scope
The cfg-gate checker walked backwards from `use` lines looking for `#[cfg(target_os = "macos")]`, but stopped at any code line that didn't end with `{`. This caused false positives for `use` statements inside cfg-gated functions when other code lines (e.g. another `use`) appeared between the opening brace and the flagged line.
Split hasMacOSCfgAttribute into two phases: (1) check for direct attributes above the line, (2) find the enclosing block via brace depth tracking and recursively check if it's cfg-gated.1 parent 60baeba commit 539db62
3 files changed
Lines changed: 50 additions & 19 deletions
File tree
- apps/desktop/src-tauri/src
- scripts/check/checks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
268 | 280 | | |
269 | 281 | | |
270 | 282 | | |
271 | | - | |
272 | 283 | | |
273 | 284 | | |
274 | 285 | | |
275 | 286 | | |
276 | | - | |
277 | 287 | | |
278 | | - | |
279 | 288 | | |
280 | 289 | | |
281 | 290 | | |
282 | 291 | | |
283 | | - | |
284 | 292 | | |
285 | 293 | | |
286 | 294 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
301 | 313 | | |
302 | 314 | | |
303 | | - | |
304 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
305 | 322 | | |
306 | 323 | | |
307 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
946 | 946 | | |
947 | 947 | | |
948 | 948 | | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
949 | 963 | | |
950 | 964 | | |
951 | 965 | | |
| |||
0 commit comments