@ SuppressWarnings ( "checkstyle:nestedifdepth" ) protected void _computeTypes ( SarlCastedExpression cast , ITypeComputationState state ) { if ( state instanceof AbstractTypeComputationState ) { final JvmTypeReference type = cast . getType ( ) ; if ( type != null ) { state . withNonVoidExpectation ( ) . computeTypes ( cast . getTarget ( ) ) ; // Set the linked feature try { final AbstractTypeComputationState computationState = ( AbstractTypeComputationState ) state ; final CastedExpressionTypeComputationState astate = new CastedExpressionTypeComputationState ( cast , computationState , this . castOperationValidator ) ; astate . resetFeature ( cast ) ; if ( astate . isCastOperatorLinkingEnabled ( cast ) ) { final List < ? extends ILinkingCandidate > candidates = astate . getLinkingCandidates ( cast ) ; if ( ! candidates . isEmpty ( ) ) { final ILinkingCandidate best = getBestCandidate ( candidates ) ; if ( best != null ) { best . applyToModel ( computationState . getResolvedTypes ( ) ) ; } } } } catch ( Throwable exception ) { final Throwable cause = Throwables . getRootCause ( exception ) ; state . addDiagnostic ( new EObjectDiagnosticImpl ( Severity . ERROR , IssueCodes . INTERNAL_ERROR , cause . getLocalizedMessage ( ) , cast , null , - 1 , null ) ) ; } state . acceptActualType ( state . getReferenceOwner ( ) . toLightweightTypeReference ( type ) ) ; } else { state . computeTypes ( cast . getTarget ( ) ) ; } } else { super . _computeTypes ( cast , state ) ; } }
Compute the type of a casted expression .