protected String getVarName(Object ex, ITreeAppendable appendable) { String name = appendable.getName(ex); return name; }
@Override public String getName(Object key) { return this.delegate.getName(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 void doReassignThisInClosure(final ITreeAppendable b, JvmType prevType) { final String proposedName = prevType.getSimpleName()+".this"; if (!b.hasObject(proposedName)) { b.declareSyntheticVariable(prevType, proposedName); 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"); } } } } }
/** * 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); } }
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()); }
} else if(feature != null) { if (b.hasName(feature)) { name = b.getName(feature); } else { name = featureNameProvider.getSimpleName(feature);
toJavaExpression(leftOperand, b); b.append(" != null) {").increaseIndentation(); b.newLine().append(b.getName(binaryOperation)).append(" = "); toJavaExpression(leftOperand, b); b.append(";"); b.newLine().append(b.getName(binaryOperation)).append(" = "); b.append(Boolean.toString(binaryOperation.getConcreteSyntaxFeatureName().equals(expressionHelper.getOrOperator()))).append(";"); b.newLine().append(b.getName(binaryOperation)).append(" = "); toJavaExpression(rightOperand, b); b.append(";");
if (_hasName) { Pair<String, JvmDeclaredType> _mappedTo_1 = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element)); b.declareVariable(element, b.getName(_mappedTo_1)); } else { b.declareVariable(element, "");
if ((element instanceof JvmDeclaredType)) { final Object superElement = b.getObject("super"); final String superVariable = b.getName(superElement); boolean _equals = "super".equals(superVariable); if (_equals) {
appendFeatureCall(expr, b); } else { String name = b.getName(expr.getFeature()); b.append(name);
appendable.append("(").append(appendable.getName(type)).append(".class"); //$NON-NLS-1$ //$NON-NLS-2$ for (final XAbstractFeatureCall call : localReferences) { appendable.append(", "); //$NON-NLS-1$
b.append(b.getName(expr)); b.append("="); featureCalltoJavaExpression(expr, b, true);