Class MeasuredComplexity
- All Implemented Interfaces:
ToIntFunction<ISymbol>
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.
Its writer, for a synthesised construct phase 5 never visits, is MeasuredComplexityRecorder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintapplyAsInt(ISymbol symbol) The symbol's measured complexity, or 0 when it was never measured (or is unparseable).
-
Constructor Details
-
MeasuredComplexity
public MeasuredComplexity()
-
-
Method Details
-
applyAsInt
The symbol's measured complexity, or 0 when it was never measured (or is unparseable).- Specified by:
applyAsIntin interfaceToIntFunction<ISymbol>
-