Search in sources :

Example 51 with Type

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

the class TClassImpl method getSuperClass.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TClass getSuperClass() {
    ParameterizedTypeRef _superClassRef = this.getSuperClassRef();
    Type _declaredType = null;
    if (_superClassRef != null) {
        _declaredType = _superClassRef.getDeclaredType();
    }
    final Type superType = _declaredType;
    TClass _xifexpression = null;
    if ((superType instanceof TClass)) {
        _xifexpression = ((TClass) superType);
    } else {
        _xifexpression = null;
    }
    return _xifexpression;
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) Type(org.eclipse.n4js.ts.types.Type) TClass(org.eclipse.n4js.ts.types.TClass)

Example 52 with Type

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

the class TClassifierImpl method getSuperClassifiers.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Iterable<? extends TClassifier> getSuperClassifiers() {
    final List<TClassifier> result = CollectionLiterals.<TClassifier>newArrayList();
    final Object _superClassifierRefs = this.getSuperClassifierRefs();
    for (final Object superClassifierRef : ((Iterable<?>) _superClassifierRefs)) {
        if ((superClassifierRef != null)) {
            final Type declType = ((TypeRef) superClassifierRef).getDeclaredType();
            if ((declType instanceof TClassifier)) {
                result.add(((TClassifier) declType));
            }
        }
    }
    return result;
}
Also used : TClassifier(org.eclipse.n4js.ts.types.TClassifier) Type(org.eclipse.n4js.ts.types.Type) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 53 with Type

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

the class VersionedParameterizedTypeRefStructuralImpl method getTypeRefAsString.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getTypeRefAsString() {
    TypingStrategy _typingStrategy = this.getTypingStrategy();
    Type _declaredType = this.getDeclaredType();
    String _rawTypeAsString = null;
    if (_declaredType != null) {
        _rawTypeAsString = _declaredType.getRawTypeAsString();
    }
    String _plus = (_typingStrategy + _rawTypeAsString);
    String _xifexpression = null;
    boolean _isEmpty = this.getTypeArgs().isEmpty();
    if (_isEmpty) {
        _xifexpression = "";
    } else {
        final Function1<TypeArgument, String> _function = new Function1<TypeArgument, String>() {

            public String apply(final TypeArgument it) {
                return it.getTypeRefAsString();
            }
        };
        String _join = IterableExtensions.join(XcoreEListExtensions.<TypeArgument, String>map(this.getTypeArgs(), _function), ",");
        String _plus_1 = ("<" + _join);
        _xifexpression = (_plus_1 + ">");
    }
    String _plus_2 = (_plus + _xifexpression);
    String _xifexpression_1 = null;
    boolean _isEmpty_1 = this.getStructuralMembers().isEmpty();
    if (_isEmpty_1) {
        _xifexpression_1 = "";
    } else {
        final Function1<TStructMember, String> _function_1 = new Function1<TStructMember, String>() {

            public String apply(final TStructMember it) {
                return it.getMemberAsString();
            }
        };
        String _join_1 = IterableExtensions.join(XcoreEListExtensions.<TStructMember, String>map(this.getStructuralMembers(), _function_1), "; ");
        String _plus_3 = (" with { " + _join_1);
        String _plus_4 = (_plus_3 + " }");
        String _xifexpression_2 = null;
        boolean _isEmpty_2 = this.getPostponedSubstitutions().isEmpty();
        if (_isEmpty_2) {
            _xifexpression_2 = "";
        } else {
            final Function1<TypeVariableMapping, String> _function_2 = new Function1<TypeVariableMapping, String>() {

                public String apply(final TypeVariableMapping it) {
                    String _typeAsString = it.getTypeVar().getTypeAsString();
                    String _plus = (_typeAsString + "->");
                    String _typeRefAsString = it.getTypeArg().getTypeRefAsString();
                    return (_plus + _typeRefAsString);
                }
            };
            String _join_2 = IterableExtensions.join(XcoreEListExtensions.<TypeVariableMapping, String>map(this.getPostponedSubstitutions(), _function_2), ", ");
            String _plus_5 = (" [[" + _join_2);
            _xifexpression_2 = (_plus_5 + "]]");
        }
        _xifexpression_1 = (_plus_4 + _xifexpression_2);
    }
    return (_plus_2 + _xifexpression_1);
}
Also used : TypingStrategy(org.eclipse.n4js.ts.types.TypingStrategy) Type(org.eclipse.n4js.ts.types.Type) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType) TStructMember(org.eclipse.n4js.ts.types.TStructMember) TypeVariableMapping(org.eclipse.n4js.ts.typeRefs.TypeVariableMapping) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) TypeArgument(org.eclipse.n4js.ts.typeRefs.TypeArgument)

Example 54 with Type

use of org.eclipse.n4js.ts.types.Type 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 55 with Type

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

the class PropertyMethodDeclarationImpl method getDefinedFunction.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TFunction getDefinedFunction() {
    final Type defType = this.getDefinedType();
    TFunction _xifexpression = null;
    if ((defType instanceof TFunction)) {
        _xifexpression = ((TFunction) defType);
    }
    return _xifexpression;
}
Also used : Type(org.eclipse.n4js.ts.types.Type) TFunction(org.eclipse.n4js.ts.types.TFunction)

Aggregations

Type (org.eclipse.n4js.ts.types.Type)84 ContainerType (org.eclipse.n4js.ts.types.ContainerType)32 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)28 TStructuralType (org.eclipse.n4js.ts.types.TStructuralType)26 EObject (org.eclipse.emf.ecore.EObject)21 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)21 PrimitiveType (org.eclipse.n4js.ts.types.PrimitiveType)19 AnyType (org.eclipse.n4js.ts.types.AnyType)18 UndefinedType (org.eclipse.n4js.ts.types.UndefinedType)18 TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)17 NullType (org.eclipse.n4js.ts.types.NullType)17 VoidType (org.eclipse.n4js.ts.types.VoidType)17 ComposedTypeRef (org.eclipse.n4js.ts.typeRefs.ComposedTypeRef)16 ExistentialTypeRef (org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef)16 ThisTypeRef (org.eclipse.n4js.ts.typeRefs.ThisTypeRef)16 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)16 ModuleNamespaceVirtualType (org.eclipse.n4js.ts.types.ModuleNamespaceVirtualType)16 StructuralTypingResult (org.eclipse.n4js.typesystem.StructuralTypingResult)16 Result (org.eclipse.xsemantics.runtime.Result)16 BaseTypeRef (org.eclipse.n4js.ts.typeRefs.BaseTypeRef)15