protected Expression visitExpression ( Expression expr ) { if ( expr == null ) { return null ; } Expression newExpr = ( Expression ) expr . accept ( this ) ; if ( expr != newExpr ) { Type newType = newExpr . getType ( ) ; if ( newType == null || ! newType . equals ( expr . getType ( ) ) ) { Iterator < Expression . Conversion > it = expr . getConversionChain ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Expression . Conversion conv = it . next ( ) ; newExpr . convertTo ( conv . getToType ( ) , conv . isCastPreferred ( ) ) ; } } } return newExpr ; }
All expressions pass through this method to ensure the expression s type is preserved .