@@ -44,7 +44,9 @@ Property LineIsPython As array Of %Boolean;
4444/// Set to true if this class/routine is generated
4545Property Generated As %Boolean [ InitialExpression = 0 ];
4646
47- ///
47+ /// If the CodeUnit has changed since we last updated it, used to see if we need to call UpdateComplexity
48+ Property OutdatedComplexity As %Boolean [ InitialExpression = 1 ];
49+
4850/// Methods, branches, etc. within this unit of code.
4951Relationship SubUnits As TestCoverage .Data .CodeSubUnit [ Cardinality = children , Inverse = Parent ];
5052
@@ -87,6 +89,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
8789 If (tUpdatedHash '= tKnownHash ) {
8890 //Clear out old data and flag the need for an update.
8991 Set tNeedsUpdate = 1
92+ If $IsObject ($Get (tMapToUnit )) {
93+ set tMapToUnit .OutdatedComplexity = 1
94+ }
9095 &sql (delete from TestCoverage_Data .CodeUnitMap where ToHash = :tKnownHash)
9196 If (SQLCODE < 0 ) {
9297 Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
@@ -521,9 +526,10 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
521526 }
522527 }
523528
524- // Update cyclomatic complexity for methods in the linked class
529+ // Update cyclomatic complexity for methods in the linked class if we don't already have the newest version
525530 Set tClass = $Order (tCodeUnits (" CLS" ," " ),1 ,tClassCodeUnit )
526- If $IsObject ($Get (tClassCodeUnit )) {
531+ If ($IsObject ($Get (tClassCodeUnit )) && (tClassCodeUnit .OutdatedComplexity )){
532+ set tClassCodeUnit .OutdatedComplexity = 0
527533 $$$ThrowOnError(tClassCodeUnit .UpdateComplexity ())
528534 }
529535 } Catch e {
@@ -690,6 +696,9 @@ Storage Default
690696<Value name =" 5" >
691697<Value >Generated </Value >
692698</Value >
699+ <Value name =" 6" >
700+ <Value >OutdatedComplexity </Value >
701+ </Value >
693702</Data >
694703<Data name =" LineIsPython" >
695704<Attribute >LineIsPython </Attribute >
0 commit comments