use of org.eclipse.xtext.xbase.typesystem.util.ActualTypeArgumentCollector in project xtext-xtend by eclipse.
the class ActualTypeArgumentCollectorTest method mappedBy.
public Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> mappedBy(final String typeParameters, final String... alternatingTypeReferences) {
final JvmOperation operation = this.operation(typeParameters, alternatingTypeReferences);
EList<JvmTypeParameter> _typeParameters = operation.getTypeParameters();
ITypeReferenceOwner _owner = this.getOwner();
final ActualTypeArgumentCollector collector = new ActualTypeArgumentCollector(_typeParameters, BoundTypeArgumentSource.INFERRED, _owner);
int _size = ((List<String>) Conversions.doWrapArray(alternatingTypeReferences)).size();
int _minus = (_size - 1);
IntegerRange _withStep = new IntegerRange(0, _minus).withStep(2);
for (final Integer i : _withStep) {
collector.populateTypeParameterMapping(this.toLightweightTypeReference(operation.getParameters().get((i).intValue()).getParameterType()), this.toLightweightTypeReference(operation.getParameters().get(((i).intValue() + 1)).getParameterType()));
}
return collector.getTypeParameterMapping();
}
use of org.eclipse.xtext.xbase.typesystem.util.ActualTypeArgumentCollector in project xtext-xtend by eclipse.
the class ActualTypeArgumentMergeTest method mappedBy.
public Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> mappedBy(final String typeParameters, final String... alternatingTypeReferences) {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("def ");
{
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(typeParameters);
boolean _not = (!_isNullOrEmpty);
if (_not) {
_builder.append("<");
_builder.append(typeParameters);
_builder.append(">");
}
}
_builder.append(" void method(");
final Function1<String, CharSequence> _function = (String it) -> {
return it;
};
String _join = IterableExtensions.<String>join(((Iterable<String>) Conversions.doWrapArray(alternatingTypeReferences)), null, " p, ", " p", _function);
_builder.append(_join);
_builder.append(") {}");
final String signature = _builder.toString();
final XtendFunction function = this.function(signature.toString());
final JvmOperation operation = this._iXtendJvmAssociations.getDirectlyInferredOperation(function);
EList<JvmTypeParameter> _typeParameters = operation.getTypeParameters();
ITypeReferenceOwner _owner = this.getOwner();
final ActualTypeArgumentCollector collector = new ActualTypeArgumentCollector(_typeParameters, BoundTypeArgumentSource.INFERRED, _owner);
int _size = ((List<String>) Conversions.doWrapArray(alternatingTypeReferences)).size();
int _minus = (_size - 1);
IntegerRange _withStep = new IntegerRange(0, _minus).withStep(2);
for (final Integer i : _withStep) {
collector.populateTypeParameterMapping(this.toLightweightTypeReference(operation.getParameters().get((i).intValue()).getParameterType()), this.toLightweightTypeReference(operation.getParameters().get(((i).intValue() + 1)).getParameterType()));
}
return collector.getTypeParameterMapping();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations