protected boolean nullSafeMemberFeatureCallExpressionNeedsPreparation(XExpression argument, ITreeAppendable b) { if (b.hasName(argument)) return false; if (argument instanceof JvmField || argument instanceof JvmFormalParameter) return false; return true; }
@Override public boolean hasName(Object key) { return this.delegate.hasName(key); }
/** * @return the variable name under which the result of the expression is stored. Returns <code>null</code> if the * expression hasn't been assigned to a local variable before. */ /* @Nullable */ protected String getReferenceName(XExpression expr, ITreeAppendable b) { if (b.hasName(expr)) return b.getName(expr); if (expr instanceof XFeatureCall) { XFeatureCall featureCall = (XFeatureCall) expr; if (b.hasName(featureCall.getFeature())) return b.getName(featureCall.getFeature()); } return null; }
protected String getSwitchLocalVariableName(XSwitchExpression expr, ITreeAppendable b) { JvmFormalParameter declaredParam = expr.getDeclaredParam(); if (declaredParam != null) { if (b.hasName(declaredParam)) { return b.getName(declaredParam); } return null; } XExpression switchExpression = expr.getSwitch(); if (b.hasName(switchExpression)) { return b.getName(switchExpression); } if (switchExpression instanceof XFeatureCall) { XFeatureCall featureCall = (XFeatureCall) switchExpression; JvmIdentifiableElement feature = featureCall.getFeature(); if (b.hasName(feature)) { return b.getName(feature); } } return null; }
@Override /* @Nullable */ protected String getReferenceName(XExpression expr, ITreeAppendable b) { if (expr instanceof XSwitchExpression) { Object key = getSwitchExpressionKey((XSwitchExpression) expr); if (b.hasName(key)) return b.getName(key); } return super.getReferenceName(expr, b); }
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()); }
/** * Symmetric to {@link XtendGenerator#reassignThisType(ITreeAppendable, JvmDeclaredType)} */ @Override protected void doReassignThisInClosure(ITreeAppendable b, JvmType prevType) { if (prevType instanceof JvmDeclaredType && ((JvmDeclaredType) prevType).isLocal()) { if (b.hasName(Pair.of("this", prevType))) { b.declareVariable(prevType, b.getName(Pair.of("this", prevType))); } else { b.declareSyntheticVariable(prevType, ""); } if (b.hasObject("super")) { Object superElement = b.getObject("super"); if (superElement instanceof JvmType) { // Don't reassign the super of the enclosing type if it has already been reassigned String superVariable = b.getName(superElement); if ("super".equals(superVariable)) { b.declareSyntheticVariable(superElement, prevType.getSimpleName()+".super"); } } } } else { super.doReassignThisInClosure(b, prevType); } }
name = "super"; } else if(feature != null) { if (b.hasName(feature)) { name = b.getName(feature); } else {
protected void _toJavaExpression(final XClosure closure, final ITreeAppendable b) { if (b.hasName(closure)) { b.trace(closure, false).append(getVarName(closure, b)); } else { LightweightTypeReference type = getLightweightType(closure); JvmOperation operation = findImplementingOperation(type); if (operation != null) { GeneratorConfig config = b.getGeneratorConfig(); if (config != null && config.getJavaSourceVersion().isAtLeast(JAVA8) && canCompileToJavaLambda(closure, type, operation)) { toLambda(closure, b.trace(closure, false), type, operation, true); } else { toAnonymousClass(closure, b.trace(closure, false), type, operation); } } } }
if (_isLocal) { Pair<String, JvmDeclaredType> _mappedTo = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element)); boolean _hasName = b.hasName(_mappedTo); if (_hasName) { Pair<String, JvmDeclaredType> _mappedTo_1 = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
return false; RichStringForLoop forLoop = forStack.getLast(); if (appendable.hasName(forLoop)) { String varName = getVarName(forLoop, appendable); appendable.newLine();
EObject _head = IterableExtensions.<EObject>head(this.getSourceElements(it)); final AnonymousClass anonymousClass = ((AnonymousClass) _head); if (((!appendable.hasName(Pair.<String, JvmDeclaredType>of("this", it))) && this.needSyntheticThisVariable(anonymousClass, it))) { final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(anonymousClass); final LightweightTypeReference actualType = resolvedTypes.getActualType(anonymousClass);
if (b.hasName(arg)) {