@@ -207,6 +207,10 @@ function oldName(cluster, options) {
207207 return findDataForPath ( data , [ 'renames' , ...path ] ) ;
208208}
209209
210+ function hasOldName ( cluster , options ) {
211+ return oldName . call ( this , cluster , options ) !== undefined ;
212+ }
213+
210214async function asObjectiveCClass ( type , cluster , options ) {
211215 let pkgIds = await templateUtil . ensureZclPackageIds ( this ) ;
212216 let isStruct = await zclHelper
@@ -742,6 +746,50 @@ function wasRemoved(cluster, options) {
742746 return removedRelease !== undefined ;
743747}
744748
749+ function hasRenamedFields ( cluster , options ) {
750+ const data = fetchAvailabilityData ( this . global ) ;
751+ // Try to minimize duplication by reusing existing path-construction and
752+ // manipulation bits. Just use dummy values for the leaf we're going to
753+ // remove.
754+ let hashAddition ;
755+ if ( options . hash . struct ) {
756+ hashAddition = {
757+ structField : "dummy"
758+ } ;
759+ } else if ( options . hash . event ) {
760+ hashAddition = {
761+ eventField : "dummy"
762+ } ;
763+ } else if ( options . hash . command ) {
764+ hashAddition = {
765+ commandField : "dummy"
766+ } ;
767+ } else if ( options . hash . enum ) {
768+ hashAddition = {
769+ enumValue : "dummy"
770+ } ;
771+ } else if ( options . hash . bitmap ) {
772+ hashAddition = {
773+ bitmapValue : "dummy"
774+ } ;
775+ } else {
776+ throw new Error ( `hasRenamedFields called for a non-container object: ${ cluster } '${ JSON . stringfify ( options . hash ) } '` ) ;
777+ }
778+
779+ let path = makeAvailabilityPath ( cluster , {
780+ hash : {
781+ ...options . hash , ...hashAddition
782+ }
783+ } ) ;
784+
785+ // Now strip off the last bit of the path, so we're just checking for any
786+ // renames in our container.
787+ path . pop ( ) ;
788+
789+ return findDataForPath ( data , [ 'renames' , ...path ] ) !== undefined ;
790+
791+ }
792+
745793function and ( ) {
746794 let args = [ ...arguments ] ;
747795 // Strip off the options arg.
@@ -845,6 +893,9 @@ exports.async_if = async_if;
845893exports . async_and = async_and ;
846894exports . async_or = async_or ;
847895exports . async_not = async_not ;
896+ exports . oldName = oldName ;
897+ exports . hasOldName = hasOldName ;
898+ exports . hasRenamedFields = hasRenamedFields ;
848899
849900exports . meta = {
850901 category : dbEnum . helperCategory . matter ,
0 commit comments