private boolean isThisOrSuper() { if ((THIS.equals(description.getName()) || SUPER.equals(description.getName())) && (description.getElementOrProxy() instanceof JvmType) && !isSyntacticReceiverPossibleArgument()) { return true; } return false; }
@Override public boolean apply(final IEObjectDescription input) { if ((input instanceof IIdentifiableElementDescription)) { if (((!((IIdentifiableElementDescription)input).isVisible()) || (!((IIdentifiableElementDescription)input).isValidStaticState()))) { return false; } boolean _startsWith = ((IIdentifiableElementDescription)input).getName().getFirstSegment().startsWith("operator_"); if (_startsWith) { QualifiedName _operator = this.operatorMapping.getOperator(((IIdentifiableElementDescription)input).getName()); return (_operator == null); } } return true; } }
protected CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right) { if (description.getBucketId() != right.description.getBucketId()) { return CandidateCompareResult.THIS; } return CandidateCompareResult.AMBIGUOUS; }
protected String getExtensionSignature(IIdentifiableElementDescription desc) { JvmOperation operation = (JvmOperation) desc.getElementOrProxy(); StringBuilder builder = new StringBuilder(64).append(desc.getName()); String opName = operation.getSimpleName(); if (opName.length() - 3 == desc.getName().getFirstSegment().length() && opName.startsWith("set")) { builder.append("="); } appendParameters(operation, builder, desc.isExtension()); return builder.toString(); }
private boolean isInvalidThisReference(IIdentifiableElementDescription desc) { EObject object = desc.getEObjectOrProxy(); return object instanceof JvmGenericType && ((JvmGenericType) object).isInterface() && IFeatureNames.THIS.equals(desc.getName()); }
if (element instanceof IIdentifiableElementDescription) { IIdentifiableElementDescription desc = (IIdentifiableElementDescription) element; if (!desc.isVisible() || !desc.isValidStaticState() || isInvalidThisReference(desc)) { continue; if (desc.isExtension()) { // filter extensions by most specific first parameter Maps2.putIntoListMap(getExtensionSignature(desc), desc, extensionSignatures); } else { if (desc.getImplicitReceiver() != null) { if (desc.getSyntacticReceiver() instanceof XMemberFeatureCall) { continue;
protected XbaseIdeCrossrefProposalProvider.ProposalBracketInfo getProposalBracketInfo(final IEObjectDescription proposedDescription, final ContentAssistContext contentAssistContext) { final XbaseIdeCrossrefProposalProvider.ProposalBracketInfo info = new XbaseIdeCrossrefProposalProvider.ProposalBracketInfo(); if ((proposedDescription instanceof IIdentifiableElementDescription)) { final JvmIdentifiableElement jvmFeature = ((IIdentifiableElementDescription)proposedDescription).getElementOrProxy(); if ((jvmFeature instanceof JvmExecutable)) { final EList<JvmFormalParameter> parameters = ((JvmExecutable)jvmFeature).getParameters(); int _numberOfParameters = ((IIdentifiableElementDescription)proposedDescription).getNumberOfParameters(); boolean _equals = (_numberOfParameters == 1); if (_equals) { if ((((JvmExecutable)jvmFeature).getSimpleName().startsWith("set") && (!((IIdentifiableElementDescription)proposedDescription).getName().getFirstSegment().startsWith("set")))) { info.brackets = " = value"; int _length = "value".length();
if (description.isValidStaticState() == right.description.isValidStaticState()) { String concreteSyntax = description.getName().getFirstSegment(); if (getFeature().getSimpleName().equals(concreteSyntax) && (getFeatureCall().isExplicitOperationCallOrBuilderSyntax() == getFeature() instanceof JvmExecutable)) { return CandidateCompareResult.THIS; if (isStatic() != right.description.isStatic()) { if (isStatic()) { return CandidateCompareResult.OTHER; return CandidateCompareResult.THIS; if (description.isValidStaticState() != right.description.isValidStaticState()) { if (description.isValidStaticState()) { return CandidateCompareResult.THIS;
@Override public JvmIdentifiableElement getFeature() { return description.getElementOrProxy(); }
protected IFeatureLinkingCandidate createCandidate(XAbstractFeatureCall featureCall, final StackedResolvedTypes demandComputedTypes, IIdentifiableElementDescription description) { if (description.getSyntacticReceiverType() != null) { return createCandidateWithReceiverType(featureCall, demandComputedTypes, description); } // pretty much the same constraints as in #createCandidateWithReceiverType ExpressionAwareStackedResolvedTypes resolvedTypes = this.resolvedTypes.pushTypes(featureCall); ExpressionTypeComputationState state = createExpressionComputationState(featureCall, resolvedTypes); if (description instanceof ScopeProviderAccess.ErrorDescription) { ScopeProviderAccess.ErrorDescription errorDescription = (ScopeProviderAccess.ErrorDescription) description; boolean followUpError = errorDescription.isFollowUpError(); if (followUpError) { return new FollowUpError(featureCall, state); } return new UnresolvableFeatureCall(featureCall, errorDescription.getNode(), description.getName().toString(), state); } else if (description.isTypeLiteral()) { return new TypeLiteralLinkingCandidate(featureCall, description, getSingleExpectation(state), state); } else { return new FeatureLinkingCandidate(featureCall, description, getSingleExpectation(state), state); } }
return new UnresolvableFeatureCall(featureCall, errorDescription.getNode(), description.getName().toString(), state) { @Override public void applyToComputationState() { } else if (description.isTypeLiteral()) { return new TypeLiteralLinkingCandidate(featureCall, description, getSingleExpectation(state), state) { @Override
@Override protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, boolean recompute) { CandidateCompareResult result = super.compareByArgumentTypes(right, recompute); if (result == CandidateCompareResult.AMBIGUOUS && getExpression() instanceof XAssignment) { if (description.isValidStaticState() == right.description.isValidStaticState()) { if (getFeature() instanceof JvmExecutable != right.getFeature() instanceof JvmExecutable) { if (getFeature() instanceof JvmExecutable) { return CandidateCompareResult.OTHER; } return CandidateCompareResult.THIS; } } } return result; }
@Override protected void preApply() { XAbstractFeatureCall expression = getExpression(); JvmType type = getType(); if (expression instanceof XMemberFeatureCall) { if (type instanceof JvmDeclaredType) { JvmDeclaredType declaredType = (JvmDeclaredType) type; if (declaredType.getDeclaringType() == null) { helper.applyPackageFragment((XMemberFeatureCall) expression, declaredType); } else { String queriedName = description.getName().toString(); // may be Map$Entry String qualifiedName = declaredType.getIdentifier(); String packageName = Strings.emptyIfNull(declaredType.getPackageName()); if (packageName.length() + 1 + queriedName.length() == qualifiedName.length()) { helper.applyPackageFragment((XMemberFeatureCall) expression, declaredType); } } } } }
protected boolean isVisible() { return description.isVisible(); }
protected int getReceiverConformanceFlags() { if (isStatic()) throw new IllegalStateException(); if (getImplicitReceiver() != null) { return description.getImplicitReceiverConformanceFlags(); } else if (getSyntacticReceiverIfPossibleArgument() != null) { return description.getSyntacticReceiverConformanceFlags(); } throw new IllegalStateException(); }
@Override protected CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right) { if (isExtension() && right.isExtension()) { if (description.getShadowingKey().equals(right.description.getShadowingKey())) { if (description.getBucketId() == right.description.getBucketId()) { return CandidateCompareResult.AMBIGUOUS; } if (isAmbiguousExtensionProvider(right)) { return CandidateCompareResult.AMBIGUOUS; } return CandidateCompareResult.THIS; } return CandidateCompareResult.AMBIGUOUS; } return super.compareByBucket(right); }
protected XExpression getImplicitReceiver() { return description.getImplicitReceiver(); }
protected LightweightTypeReference getImplicitFirstArgumentType() { return description.getImplicitFirstArgumentType(); }
protected XExpression getImplicitFirstArgument() { return description.getImplicitFirstArgument(); }
protected String getSignature(IIdentifiableElementDescription desc) { String descName = desc.getName().getFirstSegment(); StringBuilder builder = new StringBuilder(64).append(descName); JvmIdentifiableElement elementOrProxy = desc.getElementOrProxy(); if (elementOrProxy instanceof JvmExecutable) { JvmExecutable executable = (JvmExecutable) desc.getElementOrProxy(); String opName = executable.getSimpleName(); if (opName.length() - 3 == descName.length() && opName.startsWith("set")) { builder.append("="); } appendParameters(executable, builder, desc.isExtension()); } return builder.toString(); }