Search in sources :

Example 6 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-xtend by eclipse.

the class CompilationUnitImpl method toType.

public Type toType(final JvmType delegate) {
    final Function1<JvmType, Type> _function = (JvmType it) -> {
        Type _switchResult = null;
        boolean _matched = false;
        if (delegate instanceof JvmDeclaredType) {
            _matched = true;
            _switchResult = this.toTypeDeclaration(((JvmDeclaredType) delegate));
        }
        if (!_matched) {
            if (delegate instanceof JvmTypeParameter) {
                _matched = true;
                _switchResult = this.toTypeParameterDeclaration(((JvmTypeParameter) delegate));
            }
        }
        if (!_matched) {
            if (delegate instanceof JvmVoid) {
                _matched = true;
                VoidTypeImpl _voidTypeImpl = new VoidTypeImpl();
                final Procedure1<VoidTypeImpl> _function_1 = (VoidTypeImpl it_1) -> {
                    it_1.setDelegate(((JvmVoid) delegate));
                    it_1.setCompilationUnit(this);
                };
                _switchResult = ObjectExtensions.<VoidTypeImpl>operator_doubleArrow(_voidTypeImpl, _function_1);
            }
        }
        if (!_matched) {
            if (delegate instanceof JvmPrimitiveType) {
                _matched = true;
                PrimitiveTypeImpl _primitiveTypeImpl = new PrimitiveTypeImpl();
                final Procedure1<PrimitiveTypeImpl> _function_1 = (PrimitiveTypeImpl it_1) -> {
                    it_1.setDelegate(((JvmPrimitiveType) delegate));
                    it_1.setCompilationUnit(this);
                };
                _switchResult = ObjectExtensions.<PrimitiveTypeImpl>operator_doubleArrow(_primitiveTypeImpl, _function_1);
            }
        }
        return _switchResult;
    };
    return this.<JvmType, Type>getOrCreate(delegate, _function);
}
Also used : PrimitiveTypeImpl(org.eclipse.xtend.core.macro.declaration.PrimitiveTypeImpl) JvmArrayType(org.eclipse.xtext.common.types.JvmArrayType) JvmEnumerationType(org.eclipse.xtext.common.types.JvmEnumerationType) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) XtendAnnotationType(org.eclipse.xtend.core.xtend.XtendAnnotationType) JvmType(org.eclipse.xtext.common.types.JvmType) JvmComponentType(org.eclipse.xtext.common.types.JvmComponentType) JvmPrimitiveType(org.eclipse.xtext.common.types.JvmPrimitiveType) AccessorType(org.eclipse.xtend.lib.annotations.AccessorType) Type(org.eclipse.xtend.lib.macro.declaration.Type) JvmAnnotationType(org.eclipse.xtext.common.types.JvmAnnotationType) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) JvmVoid(org.eclipse.xtext.common.types.JvmVoid) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) JvmPrimitiveType(org.eclipse.xtext.common.types.JvmPrimitiveType) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) VoidTypeImpl(org.eclipse.xtend.core.macro.declaration.VoidTypeImpl) JvmType(org.eclipse.xtext.common.types.JvmType)

Aggregations

JvmVoid (org.eclipse.xtext.common.types.JvmVoid)6 Test (org.junit.Test)5 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)2 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)2 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 URI (org.eclipse.emf.common.util.URI)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 PrimitiveTypeImpl (org.eclipse.xtend.core.macro.declaration.PrimitiveTypeImpl)1 VoidTypeImpl (org.eclipse.xtend.core.macro.declaration.VoidTypeImpl)1 XtendAnnotationType (org.eclipse.xtend.core.xtend.XtendAnnotationType)1 AccessorType (org.eclipse.xtend.lib.annotations.AccessorType)1 Type (org.eclipse.xtend.lib.macro.declaration.Type)1 JvmAnnotationType (org.eclipse.xtext.common.types.JvmAnnotationType)1 JvmArrayType (org.eclipse.xtext.common.types.JvmArrayType)1 JvmComponentType (org.eclipse.xtext.common.types.JvmComponentType)1 JvmEnumerationType (org.eclipse.xtext.common.types.JvmEnumerationType)1 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)1 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)1 JvmPrimitiveType (org.eclipse.xtext.common.types.JvmPrimitiveType)1