Search in sources :

Example 41 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class ProjectComparisonEntry method isInherited.

public boolean isInherited() {
    final EObject implParent = parent != null ? parent.getElementAPI() : null;
    final EObject impl = getElementAPI();
    if (implParent instanceof ContainerType<?> && impl instanceof TMember) {
        return impl.eContainer() != implParent;
    }
    return false;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) TMember(org.eclipse.n4js.ts.types.TMember)

Example 42 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class PropertyMethodDeclarationImpl method getDefinedTypeElement.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TMember getDefinedTypeElement() {
    TMember _xifexpression = null;
    Type _definedType = this.getDefinedType();
    boolean _tripleEquals = (_definedType == null);
    if (_tripleEquals) {
        _xifexpression = null;
    } else {
        TMember _xifexpression_1 = null;
        Type _definedType_1 = this.getDefinedType();
        if ((_definedType_1 instanceof TMember)) {
            Type _definedType_2 = this.getDefinedType();
            _xifexpression_1 = ((TMember) _definedType_2);
        } else {
            throw new IllegalArgumentException("");
        }
        _xifexpression = _xifexpression_1;
    }
    return _xifexpression;
}
Also used : Type(org.eclipse.n4js.ts.types.Type) TMember(org.eclipse.n4js.ts.types.TMember)

Example 43 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4MethodDeclarationImpl method getDefinedTypeElement.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TMember getDefinedTypeElement() {
    TMember _xifexpression = null;
    Type _definedType = this.getDefinedType();
    boolean _tripleEquals = (_definedType == null);
    if (_tripleEquals) {
        _xifexpression = null;
    } else {
        TMember _xifexpression_1 = null;
        Type _definedType_1 = this.getDefinedType();
        if ((_definedType_1 instanceof TMember)) {
            Type _definedType_2 = this.getDefinedType();
            _xifexpression_1 = ((TMember) _definedType_2);
        } else {
            throw new IllegalArgumentException("");
        }
        _xifexpression = _xifexpression_1;
    }
    return _xifexpression;
}
Also used : Type(org.eclipse.n4js.ts.types.Type) TMember(org.eclipse.n4js.ts.types.TMember)

Example 44 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSASTUtils method getOwnOrSuperCtor.

private static TMember getOwnOrSuperCtor(final ContainerType<?> ownerOfField) {
    TClass klass = (TClass) (ownerOfField instanceof TClass ? ownerOfField : null);
    while (null != klass) {
        final TMember ctor = klass.findOwnedMember(CONSTRUCTOR);
        if (null != ctor) {
            return ctor;
        }
        final ParameterizedTypeRef superClassRef = klass.getSuperClassRef();
        if (null == superClassRef) {
            klass = null;
        } else {
            final Type declaredType = superClassRef.getDeclaredType();
            klass = (TClass) (declaredType instanceof TClass ? declaredType : null);
        }
    }
    return null;
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) ContainerType(org.eclipse.n4js.ts.types.ContainerType) Type(org.eclipse.n4js.ts.types.Type) TMember(org.eclipse.n4js.ts.types.TMember) TClass(org.eclipse.n4js.ts.types.TClass)

Example 45 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSResourceDescription method getCrossRefTypeAcceptor.

private IAcceptor<EObject> getCrossRefTypeAcceptor(final Set<EObject> crossRefTypesAddHere) {
    IAcceptor<EObject> acceptor = new IAcceptor<EObject>() {

        @Override
        public void accept(EObject to) {
            if (to instanceof Type || to instanceof TVariable || to instanceof TEnumLiteral) {
                crossRefTypesAddHere.add(to);
            }
            // Add declared type of a field to cross ref types
            if (to instanceof TFunction) {
                TypeRef returnTypeRef = ((TFunction) to).getReturnTypeRef();
                crossRefTypesAddHere.add(returnTypeRef.getDeclaredType());
            }
            if (to instanceof TField) {
                TypeRef typeRef = ((TField) to).getTypeRef();
                crossRefTypesAddHere.add(typeRef.getDeclaredType());
            }
            // In case of TMember, add the containing type as well
            if (to instanceof TMember) {
                TMember casted = (TMember) to;
                ContainerType<?> declaringType = casted.getContainingType();
                crossRefTypesAddHere.add(declaringType);
            }
        }
    };
    return acceptor;
}
Also used : ContainerType(org.eclipse.n4js.ts.types.ContainerType) Type(org.eclipse.n4js.ts.types.Type) TFunction(org.eclipse.n4js.ts.types.TFunction) TVariable(org.eclipse.n4js.ts.types.TVariable) TField(org.eclipse.n4js.ts.types.TField) TEnumLiteral(org.eclipse.n4js.ts.types.TEnumLiteral) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) EObject(org.eclipse.emf.ecore.EObject) IAcceptor(org.eclipse.xtext.util.IAcceptor) TMember(org.eclipse.n4js.ts.types.TMember)

Aggregations

TMember (org.eclipse.n4js.ts.types.TMember)65 EObject (org.eclipse.emf.ecore.EObject)19 TClassifier (org.eclipse.n4js.ts.types.TClassifier)13 Type (org.eclipse.n4js.ts.types.Type)13 ContainerType (org.eclipse.n4js.ts.types.ContainerType)11 ArrayList (java.util.ArrayList)10 TClass (org.eclipse.n4js.ts.types.TClass)10 TField (org.eclipse.n4js.ts.types.TField)10 TMethod (org.eclipse.n4js.ts.types.TMethod)9 TModule (org.eclipse.n4js.ts.types.TModule)9 MemberList (org.eclipse.n4js.ts.types.util.MemberList)9 RuleEnvironment (org.eclipse.xsemantics.runtime.RuleEnvironment)9 HashSet (java.util.HashSet)8 HashMap (java.util.HashMap)7 NameStaticPair (org.eclipse.n4js.ts.types.util.NameStaticPair)7 MemberCollector (org.eclipse.n4js.utils.ContainerTypesHelper.MemberCollector)7 Optional (java.util.Optional)6 ParameterizedPropertyAccessExpression (org.eclipse.n4js.n4JS.ParameterizedPropertyAccessExpression)6 EcoreUtil2 (org.eclipse.xtext.EcoreUtil2)6 Inject (com.google.inject.Inject)5