@Override protected void doVisitParameterizedTypeReference(ParameterizedTypeReference reference, StringBuilder param) { JvmType type = reference.getType(); if (type instanceof JvmDeclaredType) { boolean local = ((JvmDeclaredType) type).isLocal(); if (local) { param.append("new "); Iterables.getLast(reference.getSuperTypes()).accept(this, param); param.append("(){}"); return; } } super.doVisitParameterizedTypeReference(reference, param); }
protected String getDeclaratorName(JvmFeature feature) { JvmDeclaredType declarator = feature.getDeclaringType(); if (declarator.isLocal()) { return "new " + Iterables.getLast(declarator.getSuperTypes()).getType().getSimpleName()+ "(){}"; } else { return declarator.getSimpleName(); } }
protected IEObjectDescription doGetSingleElement(JvmDeclaredType declarator, QualifiedName name, String firstSegment, int dollarIndex) { if (declarator.isLocal()) { JvmTypeReference superTypeReference = Iterables.getLast(declarator.getSuperTypes()); if (InferredTypeIndicator.isInferred(superTypeReference)) return findNestedTypeInLocalTypeNonResolving(declarator, name, firstSegment, dollarIndex); } Iterable<JvmDeclaredType> nestedTypes = declarator.findAllNestedTypesByName(firstSegment); for(JvmDeclaredType nested: nestedTypes) { JvmType nestedType = findNestedType(nested, 0, name); if (nestedType != null) { return toDescription(name, nestedType, dollarIndex, 0); } } return null; }
@Override public ITreeAppendable generateVisibilityModifier(final JvmMember it, final ITreeAppendable result) { ITreeAppendable _xblockexpression = null; { JvmVisibility _visibility = it.getVisibility(); boolean _equals = Objects.equal(_visibility, JvmVisibility.PRIVATE); if (_equals) { JvmDeclaredType _declaringType = it.getDeclaringType(); boolean _tripleEquals = (_declaringType == null); if (_tripleEquals) { return result; } if ((it.getDeclaringType().isLocal() && (it instanceof JvmOperation))) { JvmDeclaredType _declaringType_1 = it.getDeclaringType(); final JvmGenericType declarator = ((JvmGenericType) _declaringType_1); boolean _isAnonymous = declarator.isAnonymous(); boolean _not = (!_isAnonymous); if (_not) { return result; } } } _xblockexpression = super.generateVisibilityModifier(it, result); } return _xblockexpression; }
protected String reassignThisType(final ITreeAppendable b, final JvmDeclaredType declaredType) { String _xblockexpression = null; { boolean _hasObject = b.hasObject("this"); if (_hasObject) { final Object element = b.getObject("this"); if ((element instanceof JvmDeclaredType)) { boolean _isLocal = ((JvmDeclaredType)element).isLocal(); if (_isLocal) { b.declareVariable(element, ""); } else { String _simpleName = ((JvmDeclaredType)element).getSimpleName(); final String proposedName = (_simpleName + ".this"); b.declareVariable(element, proposedName); } } } String _xifexpression = null; if ((declaredType != null)) { _xifexpression = b.declareVariable(declaredType, "this"); } _xblockexpression = _xifexpression; } return _xblockexpression; }
/** * 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); } }
final Object element = b.getObject("this"); if ((element instanceof JvmDeclaredType)) { boolean _isLocal = ((JvmDeclaredType)element).isLocal(); if (_isLocal) { Pair<String, JvmDeclaredType> _mappedTo = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
return false; } else if (declaringType != null && declaringType != feature && declaringType.isLocal()) { XClosure closure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class); if (closure != null) {
@Override public ITreeAppendable generateMembersInBody(final JvmDeclaredType it, final ITreeAppendable appendable, final GeneratorConfig config) { ITreeAppendable _xifexpression = null; boolean _isLocal = it.isLocal(); if (_isLocal) { ITreeAppendable _xblockexpression = null;