Search in sources :

Example 1 with TypeReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl in project xtext-xtend by eclipse.

the class CompilationUnitImpl method toJvmTypeReference.

public JvmTypeReference toJvmTypeReference(final TypeReference typeRef) {
    this.checkCanceled();
    JvmTypeReference _switchResult = null;
    boolean _matched = false;
    if (typeRef instanceof TypeReferenceImpl) {
        _matched = true;
        _switchResult = ((TypeReferenceImpl) typeRef).getLightweightTypeReference().toJavaCompliantTypeReference();
    }
    if (!_matched) {
        if (typeRef instanceof InferredTypeReferenceImpl) {
            _matched = true;
            _switchResult = EcoreUtil.<XComputedTypeReferenceImplCustom>copy(((InferredTypeReferenceImpl) typeRef).getDelegate());
        }
    }
    return _switchResult;
}
Also used : InferredTypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) InferredTypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference)

Example 2 with TypeReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl in project xtext-xtend by eclipse.

the class AssociatorImpl method setPrimarySourceElement.

@Override
public void setPrimarySourceElement(final MutableElement javaElement, final Element sourceElement) {
    final Element primarySourceElement = this.unit.getTracability().getPrimarySourceElement(sourceElement);
    EObject _switchResult = null;
    boolean _matched = false;
    if (primarySourceElement instanceof TypeReferenceImpl) {
        _matched = true;
        _switchResult = ((TypeReferenceImpl) primarySourceElement).getSource();
    }
    if (!_matched) {
        if (primarySourceElement instanceof AbstractElementImpl) {
            _matched = true;
            _switchResult = ((AbstractElementImpl<?>) primarySourceElement).getDelegate();
        }
    }
    final EObject delegate = _switchResult;
    this.unit.getJvmModelAssociator().associate(delegate, ((AbstractElementImpl<?>) javaElement).getDelegate());
}
Also used : AbstractElementImpl(org.eclipse.xtend.core.macro.declaration.AbstractElementImpl) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) MutableElement(org.eclipse.xtend.lib.macro.declaration.MutableElement) Element(org.eclipse.xtend.lib.macro.declaration.Element) EObject(org.eclipse.emf.ecore.EObject)

Example 3 with TypeReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl in project xtext-xtend by eclipse.

the class CompilationUnitImpl method toTypeReference.

public TypeReference toTypeReference(final LightweightTypeReference delegate, final JvmTypeReference source) {
    TypeReferenceImpl _xblockexpression = null;
    {
        this.checkCanceled();
        if ((delegate == null)) {
            return null;
        }
        TypeReferenceImpl _typeReferenceImpl = new TypeReferenceImpl();
        final Procedure1<TypeReferenceImpl> _function = (TypeReferenceImpl it) -> {
            it.setDelegate(delegate);
            it.setCompilationUnit(this);
            it.setSource(source);
        };
        _xblockexpression = ObjectExtensions.<TypeReferenceImpl>operator_doubleArrow(_typeReferenceImpl, _function);
    }
    return _xblockexpression;
}
Also used : TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) InferredTypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1)

Example 4 with TypeReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl in project xtext-xtend by eclipse.

the class CompilationUnitImpl method toLightweightTypeReference.

public LightweightTypeReference toLightweightTypeReference(final TypeReference typeRef) {
    this.checkCanceled();
    LightweightTypeReference _switchResult = null;
    boolean _matched = false;
    if (typeRef instanceof TypeReferenceImpl) {
        _matched = true;
        _switchResult = ((TypeReferenceImpl) typeRef).getLightweightTypeReference();
    }
    if (!_matched) {
        if (typeRef instanceof InferredTypeReferenceImpl) {
            _matched = true;
            _switchResult = ((InferredTypeReferenceImpl) typeRef).getLightweightTypeReference();
        }
    }
    return _switchResult;
}
Also used : InferredTypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl) LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) InferredTypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl)

Example 5 with TypeReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl in project xtext-xtend by eclipse.

the class TracabilityImpl method isSource.

@Override
public boolean isSource(final Element element) {
    boolean _switchResult = false;
    boolean _matched = false;
    if (element instanceof XtendNamedElementImpl) {
        _matched = true;
        _switchResult = true;
    }
    if (!_matched) {
        if (element instanceof XtendAnnotationReferenceImpl) {
            _matched = true;
            _switchResult = true;
        }
    }
    if (!_matched) {
        if (element instanceof Expression) {
            _matched = true;
            _switchResult = true;
        }
    }
    if (!_matched) {
        if (element instanceof TypeReferenceImpl) {
            JvmTypeReference _source = ((TypeReferenceImpl) element).getSource();
            boolean _tripleNotEquals = (_source != null);
            if (_tripleNotEquals) {
                _matched = true;
                _switchResult = true;
            }
        }
    }
    if (!_matched) {
        _switchResult = false;
    }
    return _switchResult;
}
Also used : Expression(org.eclipse.xtend.lib.macro.expression.Expression) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) XtendNamedElementImpl(org.eclipse.xtend.core.macro.declaration.XtendNamedElementImpl) XtendAnnotationReferenceImpl(org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)

Aggregations

TypeReferenceImpl (org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl)5 InferredTypeReferenceImpl (org.eclipse.xtend.core.macro.declaration.InferredTypeReferenceImpl)3 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)2 EObject (org.eclipse.emf.ecore.EObject)1 AbstractElementImpl (org.eclipse.xtend.core.macro.declaration.AbstractElementImpl)1 XtendAnnotationReferenceImpl (org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)1 XtendNamedElementImpl (org.eclipse.xtend.core.macro.declaration.XtendNamedElementImpl)1 Element (org.eclipse.xtend.lib.macro.declaration.Element)1 MutableElement (org.eclipse.xtend.lib.macro.declaration.MutableElement)1 Expression (org.eclipse.xtend.lib.macro.expression.Expression)1 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)1 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)1