Search in sources :

Example 1 with StaticBaseTypeRef

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

the class InternalTypeSystem method applyRuleExpectedTypeInUnaryExpression.

protected Result<TypeRef> applyRuleExpectedTypeInUnaryExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnaryExpression e, final Expression expression) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    StaticBaseTypeRef _xifexpression = null;
    boolean _isTypeAware = this.jsVariantHelper.isTypeAware(e);
    if (_isTypeAware) {
        StaticBaseTypeRef _switchResult = null;
        UnaryOperator _op = e.getOp();
        if (_op != null) {
            switch(_op) {
                case DELETE:
                    _switchResult = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                case VOID:
                    _switchResult = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                case TYPEOF:
                    _switchResult = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                case INC:
                    _switchResult = RuleEnvironmentExtensions.numberTypeRef(G);
                    break;
                case DEC:
                    _switchResult = RuleEnvironmentExtensions.numberTypeRef(G);
                    break;
                case POS:
                    _switchResult = RuleEnvironmentExtensions.numberTypeRef(G);
                    break;
                case NEG:
                    _switchResult = RuleEnvironmentExtensions.numberTypeRef(G);
                    break;
                case INV:
                    _switchResult = RuleEnvironmentExtensions.numberTypeRef(G);
                    break;
                case NOT:
                    _switchResult = RuleEnvironmentExtensions.anyTypeRef(G);
                    break;
                default:
                    _switchResult = RuleEnvironmentExtensions.anyTypeRef(G);
                    break;
            }
        } else {
            _switchResult = RuleEnvironmentExtensions.anyTypeRef(G);
        }
        _xifexpression = _switchResult;
    } else {
        StaticBaseTypeRef _switchResult_1 = null;
        UnaryOperator _op_1 = e.getOp();
        if (_op_1 != null) {
            switch(_op_1) {
                case DELETE:
                    _switchResult_1 = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                case VOID:
                    _switchResult_1 = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                case TYPEOF:
                    _switchResult_1 = TypeUtils.createNonSimplifiedUnionType(RuleEnvironmentExtensions.anyTypeRef(G), RuleEnvironmentExtensions.voidTypeRef(G));
                    break;
                default:
                    _switchResult_1 = RuleEnvironmentExtensions.anyTypeRef(G);
                    break;
            }
        } else {
            _switchResult_1 = RuleEnvironmentExtensions.anyTypeRef(G);
        }
        _xifexpression = _switchResult_1;
    }
    T = _xifexpression;
    return new Result<TypeRef>(T);
}
Also used : 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) StaticBaseTypeRef(org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef) UnaryOperator(org.eclipse.n4js.n4JS.UnaryOperator) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Aggregations

UnaryOperator (org.eclipse.n4js.n4JS.UnaryOperator)1 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 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)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 StructuralTypingResult (org.eclipse.n4js.typesystem.StructuralTypingResult)1 Result (org.eclipse.xsemantics.runtime.Result)1