1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Dart-language backend: scope model, AbcSize, used-once/never-used.
//!
//! Metric spec (mirrors the Rust/C# backends' semantics where a direct
//! analogue exists):
//! - Units: top-level `function_declaration`s plus class-level members --
//! every `method_declaration` (plain methods, getters/setters,
//! constructors/factories) and file-level `getter_declaration` /
//! `setter_declaration`. Closures and local functions roll into the
//! enclosing unit.
//! - A: local declarators (+1 per declared name), pattern-declared names,
//! plain assignments to bare identifiers, compound assignments, `++`/`--`,
//! for-in heads.
//! - B: invocations, constructor invocations, cascade calls, unary
//! operators (except `++`/`--`), arithmetic/bitwise/shift binary operators.
//! - C: if / for / while / do, switch cases and defaults, catch clauses,
//! ternaries, comparisons, `&&`/`||`, `??`, `is` tests and `as` casts.
//! - UsedOnce: single plain write, pure RHS, straight-line write, single
//! read after the write. Parameters, for-in heads and catch bindings are
//! protocol, never candidates.
//! - NeverUsed: written but never read, reported at the first write;
//! same exclusions.
//!
//! Dart mirrors Swift's closure model: every unit opens a [`Block`]
//! scope -- methods/local functions/closures capture outer bindings -- so
//! nothing hard-severs resolution; root-scope bindings stay unreported
//! (`include_root_scope: false`) because top-level finals may be consumed
//! by other libraries.
pub
use crateScope;
use Tree;
pub use ;