Search in sources :

Example 1 with TStructuralType

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

the class InternalTypeSystem method applyRuleTypeObjectLiteral.

protected Result<TypeRef> applyRuleTypeObjectLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ObjectLiteral ol) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    final ParameterizedTypeRefStructural ptr = TypeRefsFactory.eINSTANCE.createParameterizedTypeRefStructural();
    ptr.setDeclaredType(RuleEnvironmentExtensions.objectType(G));
    Type _definedType = ol.getDefinedType();
    ptr.setStructuralType(((TStructuralType) _definedType));
    ptr.setDefinedTypingStrategy(TypingStrategy.STRUCTURAL);
    T = ptr;
    return new Result<TypeRef>(T);
}
Also used : Type(org.eclipse.n4js.ts.types.Type) PrimitiveType(org.eclipse.n4js.ts.types.PrimitiveType) VoidType(org.eclipse.n4js.ts.types.VoidType) AnyType(org.eclipse.n4js.ts.types.AnyType) ModuleNamespaceVirtualType(org.eclipse.n4js.ts.types.ModuleNamespaceVirtualType) NullType(org.eclipse.n4js.ts.types.NullType) UndefinedType(org.eclipse.n4js.ts.types.UndefinedType) ContainerType(org.eclipse.n4js.ts.types.ContainerType) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType) ParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) UnknownTypeRef(org.eclipse.n4js.ts.typeRefs.UnknownTypeRef) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 2 with TStructuralType

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

the class ParameterizedTypeRefStructural_IMImpl method getStructuralMembers.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    } else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        } else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
Also used : TStructMember(org.eclipse.n4js.ts.types.TStructMember) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType)

Example 3 with TStructuralType

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

the class VersionedParameterizedTypeRefStructural_IMImpl method setStructuralType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setStructuralType(TStructuralType newStructuralType) {
    TStructuralType oldStructuralType = structuralType;
    structuralType = newStructuralType;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ImPackage.VERSIONED_PARAMETERIZED_TYPE_REF_STRUCTURAL_IM__STRUCTURAL_TYPE, oldStructuralType, structuralType));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType)

Example 4 with TStructuralType

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

the class BoundThisTypeRefImpl method isDefSiteStructuralTyping.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public boolean isDefSiteStructuralTyping() {
    ParameterizedTypeRef _actualThisTypeRef = this.getActualThisTypeRef();
    if ((_actualThisTypeRef instanceof TN4Classifier)) {
        ParameterizedTypeRef _actualThisTypeRef_1 = this.getActualThisTypeRef();
        TypingStrategy _typingStrategy = ((TN4Classifier) _actualThisTypeRef_1).getTypingStrategy();
        return (_typingStrategy == TypingStrategy.STRUCTURAL);
    }
    ParameterizedTypeRef _actualThisTypeRef_2 = this.getActualThisTypeRef();
    if ((_actualThisTypeRef_2 instanceof TStructuralType)) {
        return true;
    }
    return false;
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) TypingStrategy(org.eclipse.n4js.ts.types.TypingStrategy) TN4Classifier(org.eclipse.n4js.ts.types.TN4Classifier) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType)

Example 5 with TStructuralType

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

the class BoundThisTypeRefImpl method getStructuralMembers.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    } else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        } else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
Also used : TStructMember(org.eclipse.n4js.ts.types.TStructMember) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType)

Aggregations

TStructuralType (org.eclipse.n4js.ts.types.TStructuralType)17 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 TStructMember (org.eclipse.n4js.ts.types.TStructMember)7 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)2 TN4Classifier (org.eclipse.n4js.ts.types.TN4Classifier)2 Type (org.eclipse.n4js.ts.types.Type)2 TypingStrategy (org.eclipse.n4js.ts.types.TypingStrategy)2 BaseTypeRef (org.eclipse.n4js.ts.typeRefs.BaseTypeRef)1 BoundThisTypeRef (org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef)1 ComposedTypeRef (org.eclipse.n4js.ts.typeRefs.ComposedTypeRef)1 ExistentialTypeRef (org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef)1 FunctionTypeRef (org.eclipse.n4js.ts.typeRefs.FunctionTypeRef)1 ParameterizedTypeRefStructural (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural)1 StaticBaseTypeRef (org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef)1 StructuralTypeRef (org.eclipse.n4js.ts.typeRefs.StructuralTypeRef)1 ThisTypeRef (org.eclipse.n4js.ts.typeRefs.ThisTypeRef)1 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)1 TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)1 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)1 AnyType (org.eclipse.n4js.ts.types.AnyType)1