Search in sources :

Example 11 with TypeReference

use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.

the class TypeParameterDeclarationImpl 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);
}
Also used : TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference)

Example 12 with TypeReference

use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.

the class TypeReferenceProviderImpl method newSelfTypeReference.

@Override
public TypeReference newSelfTypeReference(final Type typeDeclaration) {
    TypeReference _xifexpression = null;
    if ((typeDeclaration instanceof TypeParameterDeclarator)) {
        final Function1<TypeParameterDeclaration, TypeReference> _function = (TypeParameterDeclaration it) -> {
            return this.newTypeReference(it);
        };
        _xifexpression = this.newTypeReference(typeDeclaration, ((TypeReference[]) Conversions.unwrapArray(IterableExtensions.map(((TypeParameterDeclarator) typeDeclaration).getTypeParameters(), _function), TypeReference.class)));
    } else {
        _xifexpression = this.newTypeReference(typeDeclaration);
    }
    return _xifexpression;
}
Also used : TypeParameterDeclaration(org.eclipse.xtend.lib.macro.declaration.TypeParameterDeclaration) TypeParameterDeclarator(org.eclipse.xtend.lib.macro.declaration.TypeParameterDeclarator) TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference)

Example 13 with TypeReference

use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.

the class VoidTypeImpl 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);
}
Also used : TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference)

Example 14 with TypeReference

use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.

the class XtendTypeDeclarationImpl 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);
}
Also used : TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference)

Example 15 with TypeReference

use of org.eclipse.xtend.lib.macro.declaration.TypeReference in project xtext-xtend by eclipse.

the class XtendTypeParameterDeclarationImpl 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);
}
Also used : TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference)

Aggregations

TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)37 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)13 MutableClassDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration)10 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)10 MutableMethodDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableMethodDeclaration)8 Test (org.junit.Test)8 CompilationUnitImpl (org.eclipse.xtend.core.macro.declaration.CompilationUnitImpl)7 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)6 MutableFieldDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration)5 MutableTypeParameterDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableTypeParameterDeclaration)5 AnnotationReference (org.eclipse.xtend.lib.macro.declaration.AnnotationReference)4 Type (org.eclipse.xtend.lib.macro.declaration.Type)4 TypeParameterDeclaration (org.eclipse.xtend.lib.macro.declaration.TypeParameterDeclaration)4 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)4 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)4 Serializable (java.io.Serializable)3 EObject (org.eclipse.emf.ecore.EObject)3 MutableInterfaceDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableInterfaceDeclaration)3 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)3 JvmUpperBound (org.eclipse.xtext.common.types.JvmUpperBound)3