Class MeasuredComplexity
CommonValues.COMPLEXITY, for consumers that
treat "not measured" as zero rather than as an error.
Phase 5's AcceptableConstructComplexityOrError is the only thing that MEASURES complexity, and
it is driven by parse-tree nodes. A synthesised method - a constrained type's cloned operator, a
defaulted operator, a generated wrapper - has no parse tree node, so it is never visited and never
measured. Consumers therefore have to cope with the value being absent.
Deliberately NOT used by the two strict readers. ComplexityDirectiveListener and
AcceptableCombinedComplexitySizeOrError null-check and then parse raw, so a present-but-malformed
value throws. That is the right behaviour for them - they are validating a value the compiler itself
just wrote, and silently reading it as 0 would turn a compiler bug into a passing test. This class
exists so the TOLERANT reading has one home rather than being re-derived per consumer; it is not an
invitation to flatten those two onto it.
-
Method Summary
-
Method Details
-
of
The symbol's measured complexity, or 0 when it was never measured (or is unparseable). -
record
Record a complexity against a symbol that phase 5 will never visit.Use ONLY for synthesised constructs, and say in the caller why the number is what it is. Anything with a parse tree must be measured by phase 5, not stamped here.
-