use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.
the class CompilationUnitImpl method translate.
protected Object translate(final Object object) {
if ((object instanceof XAnnotation[])) {
final AnnotationReference[] result = new AnnotationReference[((Object[]) object).length];
int _length = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);
for (final Integer i : _doubleDotLessThan) {
result[(i).intValue()] = this.translateAnnotation(((XAnnotation[]) object)[(i).intValue()]);
}
return result;
}
if ((object instanceof XAnnotation)) {
return this.translateAnnotation(((XAnnotation) object));
}
if ((object instanceof JvmTypeReference[])) {
final TypeReference[] result_1 = new TypeReference[((Object[]) object).length];
int _length_1 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _length_1, true);
for (final Integer i_1 : _doubleDotLessThan_1) {
Object _translate = this.translate(((Object[]) object)[(i_1).intValue()]);
result_1[(i_1).intValue()] = ((TypeReference) _translate);
}
return result_1;
}
if ((object instanceof JvmTypeReference)) {
return this.toTypeReference(((JvmTypeReference) object));
}
if ((object instanceof JvmEnumerationLiteral[])) {
final EnumerationValueDeclaration[] result_2 = new EnumerationValueDeclaration[((Object[]) object).length];
int _length_2 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, _length_2, true);
for (final Integer i_2 : _doubleDotLessThan_2) {
Object _translate_1 = this.translate(((Object[]) object)[(i_2).intValue()]);
result_2[(i_2).intValue()] = ((EnumerationValueDeclaration) _translate_1);
}
return result_2;
}
if ((object instanceof JvmEnumerationLiteral)) {
return this.toMemberDeclaration(((JvmMember) object));
}
return object;
}
use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.
the class JvmExecutableDeclarationImpl method setExceptions.
public void setExceptions(final TypeReference... exceptions) {
this.checkMutable();
ConditionUtils.checkIterable(((Iterable<?>) Conversions.doWrapArray(exceptions)), "exceptions");
ConditionUtils.checkInferredTypeReferences("exception type", exceptions);
this.getDelegate().getExceptions().clear();
for (final TypeReference exceptionType : exceptions) {
if ((exceptionType != null)) {
this.getDelegate().getExceptions().add(this.getCompilationUnit().toJvmTypeReference(exceptionType));
}
}
}
use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.
the class JvmTypeParameterDeclarationImpl method isAssignableFrom.
@Override
public boolean isAssignableFrom(final Type otherType) {
if ((otherType == null)) {
return false;
}
final TypeReference thisTypeRef = this.getCompilationUnit().getTypeReferenceProvider().newTypeReference(this);
final TypeReference thatTypeRef = this.getCompilationUnit().getTypeReferenceProvider().newTypeReference(otherType);
return thisTypeRef.isAssignableFrom(thatTypeRef);
}
use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.
the class MutableJvmTypeParameterDeclarationImpl method setUpperBounds.
@Override
public void setUpperBounds(final Iterable<? extends TypeReference> upperBounds) {
this.checkMutable();
ConditionUtils.checkIterable(upperBounds, "upperBounds");
ConditionUtils.checkInferredTypeReferences("parameter type", ((TypeReference[]) Conversions.unwrapArray(upperBounds, TypeReference.class)));
this.getDelegate().getConstraints().clear();
for (final TypeReference upper : upperBounds) {
{
final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper);
final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound();
jvmUpperBound.setTypeReference(typeRef);
this.getDelegate().getConstraints().add(jvmUpperBound);
}
}
}
use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.
the class ResolvedExecutableImpl method getResolvedParameters.
@Override
public Iterable<? extends ResolvedParameter> getResolvedParameters() {
Iterable<? extends ResolvedParameter> _xblockexpression = null;
{
if ((this.resolvedParameters == null)) {
int _size = this.getDelegate().getDeclaration().getParameters().size();
final Function1<Integer, ResolvedParameterImpl> _function = (Integer i) -> {
ParameterDeclaration _parameterDeclaration = this.getCompilationUnit().toParameterDeclaration(this.getDelegate().getDeclaration().getParameters().get((i).intValue()));
TypeReference _typeReference = this.getCompilationUnit().toTypeReference(this.getDelegate().getResolvedParameterTypes().get((i).intValue()));
return new ResolvedParameterImpl(_parameterDeclaration, _typeReference);
};
this.resolvedParameters = IterableExtensions.<Integer, ResolvedParameterImpl>map(new ExclusiveRange(0, _size, true), _function);
}
_xblockexpression = this.resolvedParameters;
}
return _xblockexpression;
}
Aggregations