assert simpleName != null; assert feature != null; final JvmOperation operation = this.associations.getDirectlyInferredOperation(feature); if (operation != null) { if (this.conversions == null) {
/** Check if the given action has a valid name. * * @param action the action to test. * @see SARLFeatureNameValidator */ @Check(CheckType.FAST) public void checkActionName(SarlAction action) { final JvmOperation inferredType = this.associations.getDirectlyInferredOperation(action); final QualifiedName name = QualifiedName.create(inferredType.getQualifiedName('.').split("\\.")); //$NON-NLS-1$ if (this.featureNames.isDisallowedName(name)) { final String validName = Utils.fixHiddenMember(action.getName()); error(MessageFormat.format( Messages.SARLValidator_39, action.getName()), action, XTEND_FUNCTION__NAME, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, INVALID_MEMBER_NAME, validName); } else if (!isIgnored(DISCOURAGED_FUNCTION_NAME) && this.featureNames.isDiscouragedName(name)) { warning(MessageFormat.format( Messages.SARLValidator_39, action.getName()), action, XTEND_FUNCTION__NAME, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, DISCOURAGED_FUNCTION_NAME); } }
/** Replies the expected type of the given executable. * * @param executable the executable. * @param declaredReturnType the declared return type, if one. * @return the expected type or {@code null} if none ({@code void}). */ protected LightweightTypeReference getExpectedType(XtendExecutable executable, JvmTypeReference declaredReturnType) { if (declaredReturnType == null) { // Try to get any inferred return type. if (executable instanceof XtendFunction) { final XtendFunction function = (XtendFunction) executable; final JvmOperation operation = this.sarlAssociations.getDirectlyInferredOperation(function); if (operation != null) { return Utils.toLightweightTypeReference(operation.getReturnType(), this.services); } } if (!getEarlyExitComputer().isEarlyExit(executable.getExpression())) { return getExpectedType(executable.getExpression()); } return null; } if (!"void".equals(declaredReturnType.getIdentifier())) { //$NON-NLS-1$ return Utils.toLightweightTypeReference(declaredReturnType, this.services); } return null; }