protected String getVarName(JvmIdentifiableElement ex) { return ex.getSimpleName(); } }
public String getSimpleName() { return this.getDelegate().getSimpleName(); }
protected String getSimpleFeatureName() { return getFeature().getSimpleName(); }
private String getQualifiedSimpleName(JvmIdentifiableElement element) { if (element.eContainer() instanceof JvmType) { return getQualifiedSimpleName((JvmIdentifiableElement) element.eContainer()) + "." + element.getSimpleName(); } return element.getSimpleName(); }
protected boolean isValidAssignmentName(IIdentifiableElementDescription description) { JvmIdentifiableElement candidate = description.getElementOrProxy(); if (candidate.eClass() == TypesPackage.Literals.JVM_OPERATION) { if (candidate.getSimpleName().equals(description.getName().getFirstSegment())) { return false; } else if (!candidate.getSimpleName().startsWith("set")) { return false; } } return true; }
protected boolean isRenameable(JvmIdentifiableElement element) { String simpleName = element.getSimpleName(); if (!simpleName.startsWith("_")) { return false; } EObject source = associations.getPrimarySourceElement(element); return (isCreateExtension(source) && (simpleName .startsWith(XtendJvmModelInferrer.CREATE_CHACHE_VARIABLE_PREFIX) || simpleName .startsWith(XtendJvmModelInferrer.CREATE_INITIALIZER_PREFIX))) || isAnonymousExtensionField(source); }
protected boolean isGetClass(JvmIdentifiableElement feature) { if (feature instanceof JvmOperation && feature.getSimpleName().equals("getClass")) { JvmOperation getClassOperation = (JvmOperation) feature; if (getClassOperation.getParameters().isEmpty() && "java.lang.Object".equals(getClassOperation.getDeclaringType().getIdentifier())) { return true; } } return false; }
protected boolean isAliased(IEObjectDescription desc) { String actualName = ((JvmIdentifiableElement) desc.getEObjectOrProxy()).getSimpleName(); String usedName = desc.getName().getFirstSegment(); if (actualName.equals(usedName)) { return false; } return true; }
@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()]); }
public void assertIdentifiableTypeIsResolved(final JvmIdentifiableElement identifiable, final IResolvedTypes types) { String _simpleName = identifiable.getSimpleName(); boolean _tripleEquals = (_simpleName == null); if (_tripleEquals) { return; } final LightweightTypeReference type = types.getActualType(identifiable); Assert.assertNotNull(identifiable.toString(), type); String _string = identifiable.toString(); String _plus = (_string + " / "); String _plus_1 = (_plus + type); Assert.assertNotNull(_plus_1, type.getIdentifier()); } }
@Override public String getShadowingKey() { EObject object = getEObjectOrProxy(); if (object instanceof JvmIdentifiableElement) { JvmIdentifiableElement identifiable = (JvmIdentifiableElement) object; StringBuilder builder = new StringBuilder(identifiable.getSimpleName()); computeShadowingKey(identifiable, builder); return builder.toString(); } return getName().toString() + (isVisible() ? '+' : '-'); }
private static void loopReceiver(LinkedList<String> sourceFeature, Object obj) { if (obj instanceof XMemberFeatureCall) { final XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) obj; sourceFeature.addFirst(memberFeatureCall.getFeature().getSimpleName()); loopReceiver(sourceFeature, memberFeatureCall.getMemberCallTarget()); } else if (obj instanceof XFeatureCall) { final XFeatureCall featureCall = (XFeatureCall) obj; sourceFeature.addFirst(featureCall.getFeature().getIdentifier()); } }
@Override public void addLocalToCurrentScope(JvmIdentifiableElement element) { String simpleName = element.getSimpleName(); if (Strings.isNullOrEmpty(simpleName)) return; QualifiedName elementName = QualifiedName.create(simpleName); addLocalToCurrentScope(elementName, element, !getResolver().isShadowingAllowed(elementName)); }
private void buildLeftOperand(XAbstractFeatureCall expr, List<Object> output) { final XBinaryOperation binaryOperation = (XBinaryOperation) expr; final XAbstractFeatureCall leftOperand = (XAbstractFeatureCall) binaryOperation.getLeftOperand(); final JvmIdentifiableElement feature = leftOperand.getFeature(); if (this.codeReceiver.hasName(feature)) { output.add(this.codeReceiver.getName(feature)); return; } buildCallReceiver(leftOperand, getExtraLanguageKeywordProvider().getThisKeywordLambda(), this.referenceNameLambda, output); output.add(feature.getSimpleName()); }
@Check public void checkExplicitOperationCall(XFeatureCall featureCall) { if (featureCall.getFeature() instanceof JvmOperation && !featureCall.isExplicitOperationCallOrBuilderSyntax() && featureCall.getFeature().getSimpleName().equals(featureCall.getConcreteSyntaxFeatureName())) { addIssue("Method call without parentheses", featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, OPERATION_WITHOUT_PARENTHESES); } }
@Check public void checkExplicitOperationCall(XMemberFeatureCall featureCall) { if (featureCall.getFeature() instanceof JvmOperation && !featureCall.isExplicitOperationCallOrBuilderSyntax() && featureCall.getFeature().getSimpleName().equals(featureCall.getConcreteSyntaxFeatureName())) { addIssue("Method call without parentheses", featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, OPERATION_WITHOUT_PARENTHESES); } }
public boolean isOperatorFromExtension(XAbstractFeatureCall featureCall, String concreteSyntax, QualifiedName operatorSymbol, Class<?> definingExtensionClass) { if(!equal(concreteSyntax, operatorSymbol.getLastSegment())) return false; List<QualifiedName> methodNames = getMethodNames(featureCall, operatorSymbol); JvmDeclaredType definingJvmType = (JvmDeclaredType) typeReferences.findDeclaredType(definingExtensionClass, featureCall); if (definingJvmType == null) return false; JvmIdentifiableElement feature = featureCall.getFeature(); if (definingJvmType != feature.eContainer()) { return false; } for (QualifiedName methodName : methodNames) { if (methodName.getLastSegment().equals(feature.getSimpleName())) { return true; } } return false; }
/** Replies if the given operator is a reassignment operator. * A reassignment operator changes its left operand. * * @param operator the operator. * @return {@code true} if the operator changes its left operand. */ protected boolean isReassignmentOperator(XBinaryOperation operator) { if (operator.isReassignFirstArgument()) { return true; } final QualifiedName operatorName = this.operatorMapping.getOperator( QualifiedName.create(operator.getFeature().getSimpleName())); final QualifiedName compboundOperatorName = this.operatorMapping.getSimpleOperator(operatorName); return compboundOperatorName != null; }
protected boolean isCompoundOperator() { if (!(getFeatureCall() instanceof XBinaryOperation)) { return false; } String methodName = getFeature().getSimpleName(); return getState().getReferenceOwner().getServices().getOperatorMapping().isCompoundMethod(methodName); }
protected ITreeAppendable appendLeftOperand(final XAbstractFeatureCall expr, ITreeAppendable appendable, boolean isExpressionContext) { XBinaryOperation binaryOperation = (XBinaryOperation) expr; XAbstractFeatureCall leftOperand = (XAbstractFeatureCall) binaryOperation.getLeftOperand(); JvmIdentifiableElement feature = leftOperand.getFeature(); if (appendable.hasName(feature)) { return appendable.append(appendable.getName(feature)); } boolean hasReceiver = appendReceiver(leftOperand, appendable, isExpressionContext); if (hasReceiver) { appendable.append("."); } return appendable.append(feature.getSimpleName()); }