@@ -92,13 +92,13 @@ bool CommsField::commsPrepare()
9292 auto & obj = m_genField.genParseObj ();
9393
9494 bool overrides =
95- commsPrepareOverrideInternal (obj.parseValueOverride (), " value" , &CommsField::commsCustomValueCodeInternal, m_customCode.m_value , & m_customCode.m_hasValue ) &&
96- commsPrepareOverrideInternal (obj.parseReadOverride (), " read" , &CommsField::commsCustomReadCodeInternal, m_customCode.m_read , & m_customCode.m_hasRead ) &&
97- commsPrepareOverrideInternal (obj.parseWriteOverride (), " write" , &CommsField::commsCustomWriteCodeInternal, m_customCode.m_write , & m_customCode.m_hasWrite ) &&
98- commsPrepareOverrideInternal (obj.parseRefreshOverride (), " refresh" , &CommsField::commsCustomRefreshCodeInternal, m_customCode.m_refresh , & m_customCode.m_hasRefresh ) &&
99- commsPrepareOverrideInternal (obj.parseLengthOverride (), " length" , &CommsField::commsCustomLengthCodeInternal, m_customCode.m_length , & m_customCode.m_hasLength ) &&
100- commsPrepareOverrideInternal (obj.parseValidOverride (), " valid" , &CommsField::commsCustomValidCodeInternal, m_customCode.m_valid , & m_customCode.m_hasValid ) &&
101- commsPrepareOverrideInternal (obj.parseNameOverride (), " name" , &CommsField::commsCustomNameCodeInternal, m_customCode.m_name , & m_customCode.m_hasName )
95+ commsPrepareOverrideInternal (obj.parseValueOverride (), " value" , &CommsField::commsCustomValueCodeInternal, m_customCode.m_value , m_customCode.m_hasValue ) &&
96+ commsPrepareOverrideInternal (obj.parseReadOverride (), " read" , &CommsField::commsCustomReadCodeInternal, m_customCode.m_read , m_customCode.m_hasRead ) &&
97+ commsPrepareOverrideInternal (obj.parseWriteOverride (), " write" , &CommsField::commsCustomWriteCodeInternal, m_customCode.m_write , m_customCode.m_hasWrite ) &&
98+ commsPrepareOverrideInternal (obj.parseRefreshOverride (), " refresh" , &CommsField::commsCustomRefreshCodeInternal, m_customCode.m_refresh , m_customCode.m_hasRefresh ) &&
99+ commsPrepareOverrideInternal (obj.parseLengthOverride (), " length" , &CommsField::commsCustomLengthCodeInternal, m_customCode.m_length , m_customCode.m_hasLength ) &&
100+ commsPrepareOverrideInternal (obj.parseValidOverride (), " valid" , &CommsField::commsCustomValidCodeInternal, m_customCode.m_valid , m_customCode.m_hasValid ) &&
101+ commsPrepareOverrideInternal (obj.parseNameOverride (), " name" , &CommsField::commsCustomNameCodeInternal, m_customCode.m_name , m_customCode.m_hasName )
102102 ;
103103
104104 if (!overrides) {
@@ -850,7 +850,7 @@ bool CommsField::commsPrepareOverrideInternal(
850850 const std::string& name,
851851 CommsCustomCodeFunc codeFunc,
852852 std::string& code,
853- bool * hasCode)
853+ bool & hasCode)
854854{
855855 if (commsIsOverrideCodeRequired (type) && (!comms::genIsGlobalField (m_genField))) {
856856 m_genField.genGenerator ().genLogger ().genError (
@@ -859,32 +859,24 @@ bool CommsField::commsPrepareOverrideInternal(
859859 return false ;
860860 }
861861
862- auto updateHasCodeFlag =
863- [hasCode](bool val)
864- {
865- if (hasCode != nullptr ) {
866- *hasCode = val;
867- }
868- };
869-
870862 do {
871863 if (!commsIsOverrideCodeAllowed (type)) {
872864 code.clear ();
873- updateHasCodeFlag ( false ) ;
865+ hasCode = false ;
874866 break ;
875867 }
876868
877869 bool hasCodeTmp = false ;
878870 auto customCode = (this ->*codeFunc)(hasCodeTmp);
879- if ((hasCodeTmp) || (code. empty () )) {
871+ if ((hasCodeTmp) || (!hasCode )) {
880872 code = std::move (customCode);
881- updateHasCodeFlag ( hasCodeTmp) ;
873+ hasCode = hasCode || hasCodeTmp;
882874 break ;
883875 }
884876
885877 } while (false );
886878
887- if (code. empty ( ) && commsIsOverrideCodeRequired (type)) {
879+ if ((!hasCode ) && commsIsOverrideCodeRequired (type)) {
888880 m_genField.genGenerator ().genLogger ().genError (
889881 " Overriding \" " + name + " \" operation is not provided in injected code for field \" " +
890882 m_genField.genParseObj ().parseExternalRef () + " \" ." );
0 commit comments