/** Get the string representation of an operator. * * @param call the call to the operator feature. * @return the string representation of the operator or {@code null} if not a valid operator. */ protected String getOperatorSymbol(XAbstractFeatureCall call) { if (call != null) { final Resource res = call.eResource(); if (res instanceof StorageAwareResource) { final boolean isLoadedFromStorage = ((StorageAwareResource) res).isLoadedFromStorage(); if (isLoadedFromStorage) { final QualifiedName operator = getOperatorMapping().getOperator( QualifiedName.create(call.getFeature().getSimpleName())); return Objects.toString(operator); } } return call.getConcreteSyntaxFeatureName(); } return null; }
protected String getOperator(final XAbstractFeatureCall call) { String _switchResult = null; Resource _eResource = call.eResource(); final Resource res = _eResource; boolean _matched = false; if (res instanceof StorageAwareResource) { boolean _isLoadedFromStorage = ((StorageAwareResource)res).isLoadedFromStorage(); if (_isLoadedFromStorage) { _matched=true; QualifiedName _operator = this.operatorMapping.getOperator(QualifiedName.create(call.getFeature().getSimpleName())); String _string = null; if (_operator!=null) { _string=_operator.toString(); } return _string; } } if (!_matched) { _switchResult = call.getConcreteSyntaxFeatureName(); } return _switchResult; }
protected IFeatureLinkingCandidate getKnownFeature(XAbstractFeatureCall featureCall, AbstractTypeComputationState state, ResolvedTypes resolvedTypes) { IFeatureLinkingCandidate result = resolvedTypes.getFeature(featureCall); if (result != null) { return new AppliedFeatureLinkingCandidate(result); } EObject proxyOrResolved = (EObject) featureCall.eGet(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false); if (proxyOrResolved == null) { return new NullFeatureLinkingCandidate(featureCall, state); } if (!proxyOrResolved.eIsProxy()) { return state.createResolvedLink(featureCall, (JvmIdentifiableElement) proxyOrResolved); } if (!encoder.isCrossLinkFragment(featureCall.eResource(), EcoreUtil.getURI(proxyOrResolved).fragment())) { JvmIdentifiableElement feature = featureCall.getFeature(); if (!feature.eIsProxy()) { return state.createResolvedLink(featureCall, feature); } } return null; }
@Override protected CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> right) { if (!(right instanceof FeatureLinkingCandidate) || getState().isIgnored(IssueCodes.SUSPICIOUSLY_OVERLOADED_FEATURE)) return CandidateCompareResult.OTHER; FeatureLinkingCandidate casted = (FeatureLinkingCandidate) right; XExpression otherImplicitReceiver = casted.getImplicitReceiver(); if (otherImplicitReceiver != null) { if (isStatic() == casted.isStatic()) { if (otherImplicitReceiver instanceof XAbstractFeatureCall && getImplicitReceiver() instanceof XAbstractFeatureCall) { JvmIdentifiableElement otherImplicitReceiverFeature = ((XAbstractFeatureCall) otherImplicitReceiver).getFeature(); if (otherImplicitReceiverFeature != ((XAbstractFeatureCall) getImplicitReceiver()).getFeature()) return CandidateCompareResult.SUSPICIOUS_OTHER; } } } else { if (isStatic() && casted.isStatic()) { JvmIdentifiableElement otherFeature = casted.getFeature(); if (getFeature().eContainer() != otherFeature.eContainer() && otherFeature.eResource() == getExpression().eResource()) { if (EcoreUtil.isAncestor(otherFeature.eContainer(), getFeature())) { return CandidateCompareResult.SUSPICIOUS_OTHER; } } } } return CandidateCompareResult.OTHER; }