protected boolean isOperationCallSyntax() { XAbstractFeatureCall featureCall = getFeatureCall(); if (featureCall instanceof XBinaryOperation || featureCall instanceof XAssignment) { return false; } return featureCall.isExplicitOperationCallOrBuilderSyntax(); }
protected boolean looksLikeLocalVariable(XAbstractFeatureCall featureCall) { if (featureCall instanceof XFeatureCall) { boolean result = !featureCall.isExplicitOperationCallOrBuilderSyntax() && featureCall.getTypeArguments().isEmpty(); return result; } return false; }
private boolean canBeTypeLiteral(XAbstractFeatureCall featureCall) { return !featureCall.isExplicitOperationCallOrBuilderSyntax() && featureCall.getTypeArguments().isEmpty(); }
protected boolean isExplicitOperationCall() { return getFeatureCall().isExplicitOperationCallOrBuilderSyntax(); }
public TypeLiteralLinkingCandidate( XAbstractFeatureCall featureCall, IIdentifiableElementDescription description, ITypeExpectation expectation, final ExpressionTypeComputationState state) { super(featureCall, description, expectation, state, new TypeLiteralLinkingCandidateResolver(featureCall) { @Override protected IFeatureLinkingCandidate getLinkingCandidate(XExpression target) { return state.getResolvedTypes().getLinkingCandidate((XAbstractFeatureCall) target); } }); if (featureCall.isExplicitOperationCallOrBuilderSyntax()) { throw new IllegalArgumentException("Cannot be a type literal: " + String.valueOf(featureCall)); } this.helper = new TypeLiteralHelper(state); }
@Override protected String[] getDiagnosticData() { FeatureLinkingCandidate primaryCandidate = getPrimaryCandidate(); XAbstractFeatureCall expression = primaryCandidate.getExpression(); if (expression.isExplicitOperationCallOrBuilderSyntax()) { return null; } Set<String> data = Sets.newLinkedHashSet(); for (ILinkingCandidate candidate : getAlternatives()) { JvmIdentifiableElement feature = candidate.getFeature(); String simpleName = feature.getSimpleName(); data.add(simpleName + "()"); } return data.toArray(new String[data.size()]); }
@Override protected List<IEObjectDescription> getLocalElementsByName(QualifiedName name) { XAbstractFeatureCall featureCall = getFeatureCall(); if (featureCall.isExplicitOperationCallOrBuilderSyntax()) return Collections.emptyList(); if (rawEnclosingType instanceof JvmDeclaredType && name.getSegmentCount() == 1) { String singleSegment = name.getFirstSegment(); List<String> lookup = Collections.singletonList(singleSegment); if (singleSegment.indexOf('$') != -1) { lookup = Strings.split(singleSegment, '$'); } JvmType result = findNestedType((JvmDeclaredType)rawEnclosingType, lookup.iterator()); if (result != null) { IEObjectDescription description = EObjectDescription.create(name, result); return Collections.<IEObjectDescription>singletonList(new TypeLiteralDescription(description, enclosingType, isVisible(result))); } } return Collections.emptyList(); }
public boolean isDefiniteTypeLiteral(XAbstractFeatureCall featureCall) { if (featureCall.isExplicitOperationCallOrBuilderSyntax()) return false; if (!featureCall.getTypeArguments().isEmpty()) return false; if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer(); if (container.isExplicitStatic()) { return true; } return isDefiniteTypeLiteral(container); } return false; }
@Override protected List<IEObjectDescription> getLocalElementsByName(QualifiedName name) { XAbstractFeatureCall featureCall = getFeatureCall(); if (featureCall.isExplicitOperationCallOrBuilderSyntax()) return Collections.emptyList(); QualifiedName fqn = parentSegments.append(name); IScope typeScope = getSession().getScope(getFeatureCall(), TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, resolvedTypes); IEObjectDescription typeDescription = typeScope.getSingleElement(fqn); if (typeDescription != null) { EObject type = typeDescription.getEObjectOrProxy(); if (type instanceof JvmType) return Collections.<IEObjectDescription>singletonList(new TypeLiteralDescription( new AliasedEObjectDescription(name, typeDescription), isVisible((JvmType) type))); } return Collections.emptyList(); }
/** * Considers the given name to be a property name. If the concrete syntax of the * processed feature matches a feature call or assignment, a prefix is added to the * name and that one is used as a variant that should be processed. */ protected void processAsPropertyNames(QualifiedName name, NameAcceptor acceptor) { String nameAsPropertyName = tryGetAsPropertyName(name.toString()); if (nameAsPropertyName != null) { if (featureCall == null || featureCall instanceof XAssignment) { String aliasedSetter = "set" + nameAsPropertyName; acceptor.accept(aliasedSetter, 2); } if (!(featureCall instanceof XAssignment)) { if (featureCall == null || !getFeatureCall().isExplicitOperationCallOrBuilderSyntax()) { String aliasedGetter = "get" + nameAsPropertyName; acceptor.accept(aliasedGetter, 2); String aliasedBooleanGetter = "is" + nameAsPropertyName; acceptor.accept(aliasedBooleanGetter, 2); } } } }
protected IScope getExecutableScope(XAbstractFeatureCall call, JvmIdentifiableElement feature) { final String simpleName = feature.getSimpleName(); QualifiedName name = QualifiedName.create(simpleName); if (call.isOperation()) { QualifiedName operator = getOperator(call, name); if (operator == null) { return IScope.NULLSCOPE; } return new SingletonScope(EObjectDescription.create(operator, feature), IScope.NULLSCOPE); } if (call instanceof XAssignment) { return getAccessorScope(simpleName, name, feature); } if (call.isExplicitOperationCallOrBuilderSyntax() || ((JvmExecutable) feature).getParameters().size() > 1 || (!call.isExtension() && ((JvmExecutable) feature).getParameters().size() == 1)) { return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); } return getAccessorScope(simpleName, name, feature); }
if (getFeature().getSimpleName().equals(concreteSyntax) && (getFeatureCall().isExplicitOperationCallOrBuilderSyntax() == getFeature() instanceof JvmExecutable)) { return CandidateCompareResult.THIS; } else if (right.getFeature().getSimpleName().equals(concreteSyntax) && (getFeatureCall().isExplicitOperationCallOrBuilderSyntax() == right.getFeature() instanceof JvmExecutable)) { return CandidateCompareResult.OTHER;
args = IterableExtensions.<LightweightTypeReference>join(ListExtensions.<XExpression, LightweightTypeReference>map(this._featureLinkHelper.getSyntacticArguments(featureCall), _function), ", ", _function_1); boolean _isExplicitOperationCallOrBuilderSyntax = featureCall.isExplicitOperationCallOrBuilderSyntax(); final boolean orField = (!_isExplicitOperationCallOrBuilderSyntax); StringConcatenation _builder = new StringConcatenation();