Commit 2042850
[analyzer] Ignore info can parse 'word' starting with underscore
Analyzer plugin warnings and lints can be ignored with
"// Ignore: plugin_name/lint_name".
Plugins are just packages and packages can start with an underscore,
so the ignore syntax should support that too, which it did not.
This CL changes that so it's supported.
It furthermore changes the extraction method (`ignoredElements`) from
sync* to be a regular sync method because it's so much easier to step
through. It's also faster though:
Below I've run this:
```dart
Stopwatch stopwatch = Stopwatch()..start();
CommentToken token = CommentToken(
TokenType.STRING,
// One of these:
// "",
// "// Ignore: foobar, baz",
42,
);
for (int i = 0; i < 10000000; i++) {
// ignoredElements1 or ignoredElements2 -- sync* vs sync.
var list = token.ignoredElements2.toList();
// One of these:
// if (list.isNotEmpty) throw "Not empty.";
// if (list.length != 2) throw "Not right size.";
}
print("Done in ${stopwatch.elapsed}");
```
as aot-compiled, run each 10 times and put the output through `ministat`:
Empty (''), sync* vs sync:
```
Difference at 95.0% confidence
-0.629713 +/- 0.0755153
-69.6007% +/- 8.34653%
(Student's t, pooled s = 0.08037)
```
2 ignores ('// Ignore: foobar, baz'), sync* vs sync:
```
Difference at 95.0% confidence
-1.17368 +/- 0.0544388
-46.8828% +/- 2.17457%
(Student's t, pooled s = 0.0579385)
```
Change-Id: I0c1abdc8001125e32bb5bddd579a187476f2fe31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449700
Commit-Queue: Jens Johansen <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>1 parent 659978f commit 2042850
File tree
4 files changed
+98
-47
lines changed- pkg/analyzer
- lib/src
- ignore_comments
- utilities/extensions
- test/src
- ignore_comments
- utilities/extensions
4 files changed
+98
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 227 | + | |
| 228 | + | |
231 | 229 | | |
232 | 230 | | |
233 | 231 | | |
| |||
240 | 238 | | |
241 | 239 | | |
242 | 240 | | |
243 | | - | |
244 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
245 | 244 | | |
246 | 245 | | |
247 | 246 | | |
| |||
261 | 260 | | |
262 | 261 | | |
263 | 262 | | |
264 | | - | |
| 263 | + | |
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
275 | 276 | | |
276 | 277 | | |
277 | | - | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | | - | |
| 284 | + | |
284 | 285 | | |
285 | | - | |
| 286 | + | |
286 | 287 | | |
287 | 288 | | |
288 | | - | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
294 | | - | |
295 | | - | |
296 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
297 | 300 | | |
298 | 301 | | |
299 | | - | |
| 302 | + | |
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | | - | |
308 | | - | |
309 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
310 | 315 | | |
311 | 316 | | |
312 | | - | |
| 317 | + | |
313 | 318 | | |
314 | 319 | | |
315 | 320 | | |
316 | 321 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
321 | 328 | | |
322 | 329 | | |
323 | 330 | | |
| |||
328 | 335 | | |
329 | 336 | | |
330 | 337 | | |
331 | | - | |
| 338 | + | |
332 | 339 | | |
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
336 | 343 | | |
337 | 344 | | |
338 | | - | |
339 | | - | |
340 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
341 | 350 | | |
342 | 351 | | |
343 | | - | |
| 352 | + | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
| |||
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
353 | | - | |
354 | | - | |
355 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
356 | 367 | | |
357 | 368 | | |
358 | | - | |
| 369 | + | |
359 | 370 | | |
360 | 371 | | |
361 | 372 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
366 | 379 | | |
367 | 380 | | |
368 | 381 | | |
369 | | - | |
| 382 | + | |
370 | 383 | | |
371 | | - | |
| 384 | + | |
372 | 385 | | |
373 | 386 | | |
374 | 387 | | |
375 | 388 | | |
376 | 389 | | |
377 | 390 | | |
378 | | - | |
379 | | - | |
380 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
381 | 396 | | |
382 | 397 | | |
383 | | - | |
| 398 | + | |
384 | 399 | | |
385 | 400 | | |
386 | | - | |
| 401 | + | |
387 | 402 | | |
388 | 403 | | |
389 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
173 | 188 | | |
174 | 189 | | |
175 | 190 | | |
| |||
179 | 194 | | |
180 | 195 | | |
181 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
182 | 203 | | |
183 | 204 | | |
184 | 205 | | |
| |||
0 commit comments