private static boolean matchLabel ( Node target , String label ) { if ( label == null ) { return true ; } while ( target . isLabel ( ) ) { if ( target . getFirstChild ( ) . getString ( ) . equals ( label ) ) { return true ; } target = target . getParent ( ) ; } return false ; }
Check if label is actually referencing the target control structure . If label is null it always returns true .