Search in sources :

Example 1 with SimpleUnboundTypeReference

use of org.eclipse.xtend.core.tests.typesystem.SimpleUnboundTypeReference in project xtext-xtend by eclipse.

the class MockTypeParameterSubstitutor method doVisitParameterizedTypeReference.

@Override
public LightweightTypeReference doVisitParameterizedTypeReference(final ParameterizedTypeReference reference, final Set<JvmTypeParameter> visiting) {
    final JvmType type = reference.getType();
    if ((type instanceof JvmTypeParameter)) {
        boolean _add = visiting.add(((JvmTypeParameter) type));
        boolean _not = (!_add);
        if (_not) {
            return null;
        }
        try {
            final LightweightMergedBoundTypeArgument mappedReference = this.getTypeParameterMapping().get(type);
            if ((mappedReference != null)) {
                return mappedReference.getTypeReference().<Set<JvmTypeParameter>, LightweightTypeReference>accept(this, visiting);
            } else {
                ITypeReferenceOwner _owner = this.getOwner();
                Object _object = new Object();
                final SimpleUnboundTypeReference result = new SimpleUnboundTypeReference(_owner, ((JvmTypeParameter) type), _object);
                Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> _typeParameterMapping = this.getTypeParameterMapping();
                LightweightMergedBoundTypeArgument _lightweightMergedBoundTypeArgument = new LightweightMergedBoundTypeArgument(result, VarianceInfo.INVARIANT);
                _typeParameterMapping.put(((JvmTypeParameter) type), _lightweightMergedBoundTypeArgument);
                return result;
            }
        } finally {
            visiting.remove(type);
        }
    }
    return super.doVisitParameterizedTypeReference(reference, visiting);
}
Also used : LightweightMergedBoundTypeArgument(org.eclipse.xtext.xbase.typesystem.references.LightweightMergedBoundTypeArgument) Set(java.util.Set) LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) SimpleUnboundTypeReference(org.eclipse.xtend.core.tests.typesystem.SimpleUnboundTypeReference) JvmType(org.eclipse.xtext.common.types.JvmType) ITypeReferenceOwner(org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner)

Aggregations

Set (java.util.Set)1 SimpleUnboundTypeReference (org.eclipse.xtend.core.tests.typesystem.SimpleUnboundTypeReference)1 JvmType (org.eclipse.xtext.common.types.JvmType)1 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)1 ITypeReferenceOwner (org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner)1 LightweightMergedBoundTypeArgument (org.eclipse.xtext.xbase.typesystem.references.LightweightMergedBoundTypeArgument)1 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)1