Search in sources :

Example 1 with UnionTypeExpression

use of org.eclipse.n4js.ts.typeRefs.UnionTypeExpression in project n4js by eclipse.

the class InternalTypeSystem method applyRuleExpectedTypeInRelationalExpression.

protected Result<TypeRef> applyRuleExpectedTypeInRelationalExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RelationalExpression e, final Expression expression) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    RelationalOperator _op = e.getOp();
    if (_op != null) {
        switch(_op) {
            case INSTANCEOF:
                Expression _rhs = e.getRhs();
                boolean _tripleEquals = (expression == _rhs);
                if (_tripleEquals) {
                    T = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.functionTypeRef(G), TypeUtils.createTypeTypeRef(RuleEnvironmentExtensions.objectTypeRef(G), false), TypeUtils.createTypeTypeRef(RuleEnvironmentExtensions.n4EnumTypeRef(G), false));
                } else {
                    T = RuleEnvironmentExtensions.anyTypeRef(G);
                }
                break;
            case IN:
                Expression _rhs_1 = e.getRhs();
                boolean _tripleEquals_1 = (expression == _rhs_1);
                if (_tripleEquals_1) {
                    T = RuleEnvironmentExtensions.objectTypeRef(G);
                } else {
                    boolean _isTypeAware = this.jsVariantHelper.isTypeAware(e);
                    if (_isTypeAware) {
                        T = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.numberTypeRef(G), RuleEnvironmentExtensions.stringTypeRef(G));
                    } else {
                        T = RuleEnvironmentExtensions.anyTypeRef(G);
                    }
                }
                break;
            default:
                boolean _isTypeAware_1 = this.jsVariantHelper.isTypeAware(e);
                if (_isTypeAware_1) {
                    final UnionTypeExpression primsTR = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.numberTypeRef(G), RuleEnvironmentExtensions.stringTypeRef(G), RuleEnvironmentExtensions.booleanTypeRef(G));
                    Expression _xifexpression = null;
                    Expression _lhs = e.getLhs();
                    boolean _tripleEquals_2 = (expression == _lhs);
                    if (_tripleEquals_2) {
                        _xifexpression = e.getRhs();
                    } else {
                        _xifexpression = e.getLhs();
                    }
                    final Expression otherSide = _xifexpression;
                    /* G |- otherSide : var TypeRef otherSideTR */
                    TypeRef otherSideTR = null;
                    Result<TypeRef> result = typeInternal(G, _trace_, otherSide);
                    checkAssignableTo(result.getFirst(), TypeRef.class);
                    otherSideTR = (TypeRef) result.getFirst();
                    boolean _and = false;
                    /* G |- otherSideTR <: primsTR */
                    boolean _ruleinvocation = subtypeSucceeded(G, _trace_, otherSideTR, primsTR);
                    if (!_ruleinvocation) {
                        _and = false;
                    } else {
                        /* G |- otherSideTR <: G.nullTypeRef */
                        ParameterizedTypeRef _nullTypeRef = RuleEnvironmentExtensions.nullTypeRef(G);
                        boolean _ruleinvocation_1 = subtypeSucceeded(G, _trace_, otherSideTR, _nullTypeRef);
                        boolean _not = (!_ruleinvocation_1);
                        _and = _not;
                    }
                    if (_and) {
                        T = otherSideTR;
                    } else {
                        T = primsTR;
                    }
                } else {
                    T = RuleEnvironmentExtensions.anyTypeRef(G);
                }
                break;
        }
    } else {
        boolean _isTypeAware_1 = this.jsVariantHelper.isTypeAware(e);
        if (_isTypeAware_1) {
            final UnionTypeExpression primsTR = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.numberTypeRef(G), RuleEnvironmentExtensions.stringTypeRef(G), RuleEnvironmentExtensions.booleanTypeRef(G));
            Expression _xifexpression = null;
            Expression _lhs = e.getLhs();
            boolean _tripleEquals_2 = (expression == _lhs);
            if (_tripleEquals_2) {
                _xifexpression = e.getRhs();
            } else {
                _xifexpression = e.getLhs();
            }
            final Expression otherSide = _xifexpression;
            /* G |- otherSide : var TypeRef otherSideTR */
            TypeRef otherSideTR = null;
            Result<TypeRef> result = typeInternal(G, _trace_, otherSide);
            checkAssignableTo(result.getFirst(), TypeRef.class);
            otherSideTR = (TypeRef) result.getFirst();
            boolean _and = false;
            /* G |- otherSideTR <: primsTR */
            boolean _ruleinvocation = subtypeSucceeded(G, _trace_, otherSideTR, primsTR);
            if (!_ruleinvocation) {
                _and = false;
            } else {
                /* G |- otherSideTR <: G.nullTypeRef */
                ParameterizedTypeRef _nullTypeRef = RuleEnvironmentExtensions.nullTypeRef(G);
                boolean _ruleinvocation_1 = subtypeSucceeded(G, _trace_, otherSideTR, _nullTypeRef);
                boolean _not = (!_ruleinvocation_1);
                _and = _not;
            }
            if (_and) {
                T = otherSideTR;
            } else {
                T = primsTR;
            }
        } else {
            T = RuleEnvironmentExtensions.anyTypeRef(G);
        }
    }
    return new Result<TypeRef>(T);
}
Also used : RelationalOperator(org.eclipse.n4js.n4JS.RelationalOperator) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) BinaryBitwiseExpression(org.eclipse.n4js.n4JS.BinaryBitwiseExpression) AssignmentExpression(org.eclipse.n4js.n4JS.AssignmentExpression) IndexedAccessExpression(org.eclipse.n4js.n4JS.IndexedAccessExpression) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) FunctionExpression(org.eclipse.n4js.n4JS.FunctionExpression) PromisifyExpression(org.eclipse.n4js.n4JS.PromisifyExpression) UnaryExpression(org.eclipse.n4js.n4JS.UnaryExpression) ParenExpression(org.eclipse.n4js.n4JS.ParenExpression) ParameterizedCallExpression(org.eclipse.n4js.n4JS.ParameterizedCallExpression) AdditiveExpression(org.eclipse.n4js.n4JS.AdditiveExpression) PostfixExpression(org.eclipse.n4js.n4JS.PostfixExpression) YieldExpression(org.eclipse.n4js.n4JS.YieldExpression) ConditionalExpression(org.eclipse.n4js.n4JS.ConditionalExpression) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) RelationalExpression(org.eclipse.n4js.n4JS.RelationalExpression) NewExpression(org.eclipse.n4js.n4JS.NewExpression) IntersectionTypeExpression(org.eclipse.n4js.ts.typeRefs.IntersectionTypeExpression) AwaitExpression(org.eclipse.n4js.n4JS.AwaitExpression) CommaExpression(org.eclipse.n4js.n4JS.CommaExpression) Expression(org.eclipse.n4js.n4JS.Expression) CastExpression(org.eclipse.n4js.n4JS.CastExpression) BinaryLogicalExpression(org.eclipse.n4js.n4JS.BinaryLogicalExpression) EqualityExpression(org.eclipse.n4js.n4JS.EqualityExpression) ShiftExpression(org.eclipse.n4js.n4JS.ShiftExpression) ParameterizedPropertyAccessExpression(org.eclipse.n4js.n4JS.ParameterizedPropertyAccessExpression) MultiplicativeExpression(org.eclipse.n4js.n4JS.MultiplicativeExpression) N4ClassExpression(org.eclipse.n4js.n4JS.N4ClassExpression) 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) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 2 with UnionTypeExpression

use of org.eclipse.n4js.ts.typeRefs.UnionTypeExpression in project n4js by eclipse.

the class MemberVisibilityChecker method isVisible.

/**
 * Returns the MemberVisibility of the <i>member</i> of the <i>receiverType</> in the given <i>context</i>
 * <i>supercall</i> indicates if the target of the context is the super type.
 */
private MemberVisibility isVisible(EObject context, TypeRef receiverType, TMember member, boolean supercall) {
    // special case: union types
    if (receiverType instanceof UnionTypeExpression) {
        // because we use the combined accessibility for all members
        for (TypeRef currUnitedTypeRef : ((UnionTypeExpression) receiverType).getTypeRefs()) if (!isVisible(context, currUnitedTypeRef, member, supercall).visibility)
            return new MemberVisibility(false);
        return new MemberVisibility(true);
    }
    // standard case:
    Resource contextResource = context.eResource();
    N4TypeDefinition typeDefiningContainer = EcoreUtil2.getContainerOfType(context, N4TypeDefinition.class);
    Script script = EcoreUtil2.getContainerOfType(typeDefiningContainer != null ? typeDefiningContainer : context, Script.class);
    Type contextType = null;
    TModule contextModule = script.getModule();
    if (typeDefiningContainer != null) {
        contextType = typeDefiningContainer.getDefinedType();
    }
    Type declaredReceiverType = getActualDeclaredReceiverType(context, receiverType, contextResource.getResourceSet());
    if (declaredReceiverType != null && typeVisibilityChecker.isVisible(contextResource, declaredReceiverType).visibility) {
        // check for local usage of locally defined member
        if (shortcutIsVisible(member, contextType, contextModule, declaredReceiverType)) {
            return new MemberVisibility(true);
        }
        return isVisible(contextModule, contextType, declaredReceiverType, member, supercall);
    }
    return new MemberVisibility(false);
}
Also used : Script(org.eclipse.n4js.n4JS.Script) Type(org.eclipse.n4js.ts.types.Type) TStructuralType(org.eclipse.n4js.ts.types.TStructuralType) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) N4TypeDefinition(org.eclipse.n4js.n4JS.N4TypeDefinition) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) Resource(org.eclipse.emf.ecore.resource.Resource) TModule(org.eclipse.n4js.ts.types.TModule)

Example 3 with UnionTypeExpression

use of org.eclipse.n4js.ts.typeRefs.UnionTypeExpression in project n4js by eclipse.

the class TypeUtils method createNonSimplifiedUnionType.

/**
 * Creates a new union type with the given elements. The elements are copied if they have a container. The created
 * union type may contain duplicates or nested union types, that is, it is not simplified! Thus, the returned type
 * is expected to be processed further!
 *
 * @see org.eclipse.n4js.typesystem.N4JSTypeSystem#createSimplifiedUnion(List, Resource)
 * @see org.eclipse.n4js.typesystem.TypeSystemHelper#simplify(RuleEnvironment, ComposedTypeRef)
 */
@SuppressWarnings("javadoc")
public static UnionTypeExpression createNonSimplifiedUnionType(Iterable<? extends TypeRef> elements) {
    UnionTypeExpression unionType = TypeRefsFactory.eINSTANCE.createUnionTypeExpression();
    EList<TypeRef> unionElements = unionType.getTypeRefs();
    for (TypeRef e : elements) {
        unionElements.add(TypeUtils.copyIfContained(e));
    }
    return unionType;
}
Also used : ExistentialTypeRef(org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef) ThisTypeRef(org.eclipse.n4js.ts.typeRefs.ThisTypeRef) BoundThisTypeRef(org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) StructuralTypeRef(org.eclipse.n4js.ts.typeRefs.StructuralTypeRef) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) DeferredTypeRef(org.eclipse.n4js.ts.typeRefs.DeferredTypeRef) BaseTypeRef(org.eclipse.n4js.ts.typeRefs.BaseTypeRef) ComposedTypeRef(org.eclipse.n4js.ts.typeRefs.ComposedTypeRef) FunctionTypeRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeRef) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression)

Example 4 with UnionTypeExpression

use of org.eclipse.n4js.ts.typeRefs.UnionTypeExpression in project n4js by eclipse.

the class TypesSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == TypeRefsPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypeRefsPackage.FUNCTION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_ArrowFunctionTypeExpression_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList_TypeRef_TypeRefWithModifiers(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getArrowFunctionTypeExpressionRule()) {
                    sequence_ArrowFunctionTypeExpression_TAnonymousFormalParameterList(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getFunctionTypeExpressionOLDRule()) {
                    sequence_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList_TypeRefWithModifiers(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList_TypeRef(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.INTERSECTION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getIntersectionTypeExpressionOLDRule()) {
                    sequence_IntersectionTypeExpressionOLD(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_IntersectionTypeExpressionOLD_TypeRefWithModifiers(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_IntersectionTypeExpressionOLD_TypeRef(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_IntersectionTypeExpressionOLD_TypeRef_TypeRefWithModifiers(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule()) {
                    sequence_IntersectionTypeExpression_IntersectionTypeExpressionOLD_TypeRef_TypeRefWithModifiers(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.PARAMETERIZED_TYPE_REF:
                if (rule == grammarAccess.getArrayTypeRefRule()) {
                    sequence_ArrayTypeRef(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule()) {
                    sequence_ArrayTypeRef_TypeAndTypeArguments_TypeArguments(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_ArrayTypeRef_TypeAndTypeArguments_TypeArguments_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefNominalRule() || rule == grammarAccess.getTypeAndTypeArgumentsRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRef_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.PARAMETERIZED_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefStructuralRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRef_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.THIS_TYPE_REF_NOMINAL:
                if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getThisTypeRefRule() || rule == grammarAccess.getThisTypeRefNominalRule()) {
                    sequence_ThisTypeRefNominal(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_ThisTypeRefNominal_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ThisTypeRefNominal_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_ThisTypeRefNominal_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ThisTypeRefNominal_TypeRef_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.THIS_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getThisTypeRefRule() || rule == grammarAccess.getThisTypeRefStructuralRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRef_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.TYPE_TYPE_REF:
                if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeRefWithModifiers_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_TypeRef_TypeRefWithModifiers_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeRef_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getTypeTypeRefRule()) {
                    sequence_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.UNION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeRefWithModifiers_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_TypeRef_TypeRefWithModifiers_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeRef_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getUnionTypeExpressionOLDRule()) {
                    sequence_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.VERSIONED_PARAMETERIZED_TYPE_REF:
                if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRef_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefNominalRule() || rule == grammarAccess.getTypeAndTypeArgumentsRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.VERSIONED_PARAMETERIZED_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRef_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRef_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefStructuralRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.WILDCARD:
                if (rule == grammarAccess.getWildcardNewNotationRule()) {
                    sequence_WildcardNewNotation(context, (Wildcard) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getWildcardRule()) {
                    sequence_Wildcard(context, (Wildcard) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_Wildcard_WildcardNewNotation(context, (Wildcard) semanticObject);
                    return;
                } else
                    break;
        }
    else if (epackage == TypesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypesPackage.ANY_TYPE:
                sequence_AnyType(context, (AnyType) semanticObject);
                return;
            case TypesPackage.NULL_TYPE:
                sequence_NullType(context, (NullType) semanticObject);
                return;
            case TypesPackage.PRIMITIVE_TYPE:
                sequence_PrimitiveType(context, (PrimitiveType) semanticObject);
                return;
            case TypesPackage.TANNOTATION:
                sequence_TAnnotation(context, (TAnnotation) semanticObject);
                return;
            case TypesPackage.TANNOTATION_STRING_ARGUMENT:
                sequence_TAnnotationStringArgument(context, (TAnnotationStringArgument) semanticObject);
                return;
            case TypesPackage.TANNOTATION_TYPE_REF_ARGUMENT:
                sequence_TAnnotationTypeRefArgument(context, (TAnnotationTypeRefArgument) semanticObject);
                return;
            case TypesPackage.TANONYMOUS_FORMAL_PARAMETER:
                sequence_ColonSepTypeRef_DefaultFormalParameter_TAnonymousFormalParameter(context, (TAnonymousFormalParameter) semanticObject);
                return;
            case TypesPackage.TCLASS:
                sequence_TClass_TClassOrInterfaceHeader(context, (TClass) semanticObject);
                return;
            case TypesPackage.TENUM:
                sequence_TEnum(context, (TEnum) semanticObject);
                return;
            case TypesPackage.TENUM_LITERAL:
                sequence_TEnumLiteral(context, (TEnumLiteral) semanticObject);
                return;
            case TypesPackage.TFIELD:
                sequence_ColonSepTypeRef_TField(context, (TField) semanticObject);
                return;
            case TypesPackage.TFORMAL_PARAMETER:
                sequence_ColonSepTypeRef_DefaultFormalParameter_TFormalParameter(context, (TFormalParameter) semanticObject);
                return;
            case TypesPackage.TFUNCTION:
                sequence_ColonSepReturnTypeRef_TFormalParameters_TFunction_TypeVariables(context, (TFunction) semanticObject);
                return;
            case TypesPackage.TGETTER:
                sequence_ColonSepDeclaredTypeRef_TGetter(context, (TGetter) semanticObject);
                return;
            case TypesPackage.TINTERFACE:
                sequence_TClassOrInterfaceHeader_TInterface(context, (TInterface) semanticObject);
                return;
            case TypesPackage.TMETHOD:
                if (rule == grammarAccess.getCallableCtorRule()) {
                    sequence_CallableCtor_ColonSepReturnTypeRef_TFormalParameters(context, (TMethod) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTMemberRule() || rule == grammarAccess.getTMethodRule()) {
                    sequence_ColonSepReturnTypeRef_TFormalParameters_TMethod_TypeVariables(context, (TMethod) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.TOBJECT_PROTOTYPE:
                sequence_TObjectPrototype_TypeVariables(context, (TObjectPrototype) semanticObject);
                return;
            case TypesPackage.TSETTER:
                sequence_TSetter(context, (TSetter) semanticObject);
                return;
            case TypesPackage.TSTRUCT_FIELD:
                sequence_ColonSepTypeRef_TStructField(context, (TStructField) semanticObject);
                return;
            case TypesPackage.TSTRUCT_GETTER:
                sequence_ColonSepDeclaredTypeRef_TStructGetter(context, (TStructGetter) semanticObject);
                return;
            case TypesPackage.TSTRUCT_METHOD:
                sequence_ColonSepReturnTypeRef_TAnonymousFormalParameterList_TStructMethod_TypeVariables(context, (TStructMethod) semanticObject);
                return;
            case TypesPackage.TSTRUCT_SETTER:
                sequence_TStructSetter(context, (TStructSetter) semanticObject);
                return;
            case TypesPackage.TYPE_DEFS:
                sequence_TypeDefs(context, (TypeDefs) semanticObject);
                return;
            case TypesPackage.TYPE_VARIABLE:
                if (rule == grammarAccess.getTypeRule() || rule == grammarAccess.getTypeVariableRule()) {
                    sequence_TypeVariable(context, (TypeVariable) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeExpressionsTypeVariableRule()) {
                    sequence_TypeVariable(context, (TypeVariable) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.UNDEFINED_TYPE:
                sequence_UndefinedType(context, (UndefinedType) semanticObject);
                return;
            case TypesPackage.VIRTUAL_BASE_TYPE:
                sequence_VirtualBaseType(context, (VirtualBaseType) semanticObject);
                return;
            case TypesPackage.VOID_TYPE:
                sequence_VoidType(context, (VoidType) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) TMethod(org.eclipse.n4js.ts.types.TMethod) VersionedParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRefStructural) ParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) VersionedParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRefStructural) ThisTypeRefNominal(org.eclipse.n4js.ts.typeRefs.ThisTypeRefNominal) EPackage(org.eclipse.emf.ecore.EPackage) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) VersionedParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRef) Wildcard(org.eclipse.n4js.ts.typeRefs.Wildcard) TypeVariable(org.eclipse.n4js.ts.types.TypeVariable) ThisTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ThisTypeRefStructural) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) TAnonymousFormalParameter(org.eclipse.n4js.ts.types.TAnonymousFormalParameter) TFormalParameter(org.eclipse.n4js.ts.types.TFormalParameter) Parameter(org.eclipse.xtext.Parameter) IntersectionTypeExpression(org.eclipse.n4js.ts.typeRefs.IntersectionTypeExpression) VersionedParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRef)

Example 5 with UnionTypeExpression

use of org.eclipse.n4js.ts.typeRefs.UnionTypeExpression in project n4js by eclipse.

the class TypeExpressionsSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == TypeRefsPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypeRefsPackage.FUNCTION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ArrowFunctionTypeExpression_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList_TypeRefWithModifiers(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getArrowFunctionTypeExpressionRule()) {
                    sequence_ArrowFunctionTypeExpression_TAnonymousFormalParameterList(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getFunctionTypeExpressionOLDRule()) {
                    sequence_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_ColonSepReturnTypeRef_FunctionTypeExpressionOLD_TAnonymousFormalParameterList_TypeRefWithModifiers(context, (FunctionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.INTERSECTION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getIntersectionTypeExpressionOLDRule()) {
                    sequence_IntersectionTypeExpressionOLD(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_IntersectionTypeExpressionOLD_TypeRefWithModifiers(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_IntersectionTypeExpression_IntersectionTypeExpressionOLD_TypeRefWithModifiers(context, (IntersectionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.PARAMETERIZED_TYPE_REF:
                if (rule == grammarAccess.getArrayTypeRefRule()) {
                    sequence_ArrayTypeRef(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule()) {
                    sequence_ArrayTypeRef_TypeAndTypeArguments_TypeArguments(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ArrayTypeRef_TypeAndTypeArguments_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefNominalRule() || rule == grammarAccess.getTypeAndTypeArgumentsRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithoutModifiers(context, (ParameterizedTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.PARAMETERIZED_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefStructuralRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithoutModifiers(context, (ParameterizedTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.THIS_TYPE_REF_NOMINAL:
                if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getThisTypeRefRule() || rule == grammarAccess.getThisTypeRefNominalRule()) {
                    sequence_ThisTypeRefNominal(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ThisTypeRefNominal_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ThisTypeRefNominal_TypeRefWithoutModifiers(context, (ThisTypeRefNominal) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.THIS_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getThisTypeRefRule() || rule == grammarAccess.getThisTypeRefStructuralRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRefWithModifiers_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TStructMemberList_ThisTypeRefStructural_TypeRefWithoutModifiers(context, (ThisTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.TYPE_TYPE_REF:
                if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeRefWithModifiers_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getTypeTypeRefRule()) {
                    sequence_TypeTypeRef(context, (TypeTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.UNION_TYPE_EXPRESSION:
                if (rule == grammarAccess.getTypeRefWithModifiersRule()) {
                    sequence_TypeRefWithModifiers_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeRef_TypeRefWithModifiers_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule() || rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getUnionTypeExpressionOLDRule()) {
                    sequence_UnionTypeExpressionOLD(context, (UnionTypeExpression) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.VERSIONED_PARAMETERIZED_TYPE_REF:
                if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefNominalRule() || rule == grammarAccess.getTypeAndTypeArgumentsRule()) {
                    sequence_TypeAndTypeArguments_TypeArguments_VersionRequest(context, (VersionedParameterizedTypeRef) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.VERSIONED_PARAMETERIZED_TYPE_REF_STRUCTURAL:
                if (rule == grammarAccess.getTypeRefRule() || action == grammarAccess.getTypeRefAccess().getUnionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getIntersectionTypeExpressionRule() || action == grammarAccess.getIntersectionTypeExpressionAccess().getIntersectionTypeExpressionTypeRefsAction_1_0() || rule == grammarAccess.getPrimaryTypeExpressionRule() || rule == grammarAccess.getTypeRefWithModifiersRule() || rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithModifiers_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefWithoutModifiersRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_TypeRefWithoutModifiers_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeRefFunctionTypeExpressionRule() || rule == grammarAccess.getParameterizedTypeRefRule() || rule == grammarAccess.getParameterizedTypeRefStructuralRule()) {
                    sequence_ParameterizedTypeRefStructural_TStructMemberList_TypeArguments_VersionRequest(context, (VersionedParameterizedTypeRefStructural) semanticObject);
                    return;
                } else
                    break;
            case TypeRefsPackage.WILDCARD:
                if (rule == grammarAccess.getWildcardNewNotationRule()) {
                    sequence_WildcardNewNotation(context, (Wildcard) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgInTypeTypeRefRule() || rule == grammarAccess.getWildcardRule()) {
                    sequence_Wildcard(context, (Wildcard) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeArgumentRule()) {
                    sequence_Wildcard_WildcardNewNotation(context, (Wildcard) semanticObject);
                    return;
                } else
                    break;
        }
    else if (epackage == TypesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypesPackage.TANONYMOUS_FORMAL_PARAMETER:
                sequence_ColonSepTypeRef_DefaultFormalParameter_TAnonymousFormalParameter(context, (TAnonymousFormalParameter) semanticObject);
                return;
            case TypesPackage.TFORMAL_PARAMETER:
                sequence_ColonSepTypeRef_DefaultFormalParameter_TFormalParameter(context, (TFormalParameter) semanticObject);
                return;
            case TypesPackage.TSTRUCT_FIELD:
                sequence_ColonSepTypeRef_TStructField(context, (TStructField) semanticObject);
                return;
            case TypesPackage.TSTRUCT_GETTER:
                sequence_ColonSepDeclaredTypeRef_TStructGetter(context, (TStructGetter) semanticObject);
                return;
            case TypesPackage.TSTRUCT_METHOD:
                sequence_ColonSepReturnTypeRef_TAnonymousFormalParameterList_TStructMethod_TypeVariables(context, (TStructMethod) semanticObject);
                return;
            case TypesPackage.TSTRUCT_SETTER:
                sequence_TStructSetter(context, (TStructSetter) semanticObject);
                return;
            case TypesPackage.TYPE_VARIABLE:
                sequence_TypeVariable(context, (TypeVariable) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) VersionedParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRefStructural) ParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural) UnionTypeExpression(org.eclipse.n4js.ts.typeRefs.UnionTypeExpression) VersionedParameterizedTypeRefStructural(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRefStructural) ThisTypeRefNominal(org.eclipse.n4js.ts.typeRefs.ThisTypeRefNominal) EPackage(org.eclipse.emf.ecore.EPackage) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) VersionedParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRef) Wildcard(org.eclipse.n4js.ts.typeRefs.Wildcard) ThisTypeRefStructural(org.eclipse.n4js.ts.typeRefs.ThisTypeRefStructural) TypeTypeRef(org.eclipse.n4js.ts.typeRefs.TypeTypeRef) TAnonymousFormalParameter(org.eclipse.n4js.ts.types.TAnonymousFormalParameter) TFormalParameter(org.eclipse.n4js.ts.types.TFormalParameter) Parameter(org.eclipse.xtext.Parameter) IntersectionTypeExpression(org.eclipse.n4js.ts.typeRefs.IntersectionTypeExpression) VersionedParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRef)

Aggregations

TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)6 UnionTypeExpression (org.eclipse.n4js.ts.typeRefs.UnionTypeExpression)6 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)5 FunctionTypeExpression (org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression)4 IntersectionTypeExpression (org.eclipse.n4js.ts.typeRefs.IntersectionTypeExpression)4 EPackage (org.eclipse.emf.ecore.EPackage)3 ParameterizedTypeRefStructural (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRefStructural)3 ThisTypeRefNominal (org.eclipse.n4js.ts.typeRefs.ThisTypeRefNominal)3 ThisTypeRefStructural (org.eclipse.n4js.ts.typeRefs.ThisTypeRefStructural)3 VersionedParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRef)3 VersionedParameterizedTypeRefStructural (org.eclipse.n4js.ts.typeRefs.VersionedParameterizedTypeRefStructural)3 Wildcard (org.eclipse.n4js.ts.typeRefs.Wildcard)3 TAnonymousFormalParameter (org.eclipse.n4js.ts.types.TAnonymousFormalParameter)3 TFormalParameter (org.eclipse.n4js.ts.types.TFormalParameter)3 Action (org.eclipse.xtext.Action)3 Parameter (org.eclipse.xtext.Parameter)3 ParserRule (org.eclipse.xtext.ParserRule)3 AdditiveExpression (org.eclipse.n4js.n4JS.AdditiveExpression)2 AssignmentExpression (org.eclipse.n4js.n4JS.AssignmentExpression)2 AwaitExpression (org.eclipse.n4js.n4JS.AwaitExpression)2