Search in sources :

Example 76 with ParameterizedTypeRef

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

the class InternalTypeSystem method thisTypeRefImpl.

protected Result<TypeRef> thisTypeRefImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef type) throws RuleFailedException {
    try {
        final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
        final Result<TypeRef> _result_ = applyRuleThisTypeRefParameterizedTypeRef(G, _subtrace_, type);
        addToTrace(_trace_, new Provider<Object>() {

            public Object get() {
                return ruleName("thisTypeRefParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(type) + " ~> " + stringRep(_result_.getFirst());
            }
        });
        addAsSubtrace(_trace_, _subtrace_);
        return _result_;
    } catch (Exception e_applyRuleThisTypeRefParameterizedTypeRef) {
        thisTypeRefThrowException(ruleName("thisTypeRefParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(type) + " ~> " + "BoundThisTypeRef", THISTYPEREFPARAMETERIZEDTYPEREF, e_applyRuleThisTypeRefParameterizedTypeRef, type, new ErrorInformation[] { new ErrorInformation(type) });
        return null;
    }
}
Also used : ErrorInformation(org.eclipse.xsemantics.runtime.ErrorInformation) 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) RuleApplicationTrace(org.eclipse.xsemantics.runtime.RuleApplicationTrace) EObject(org.eclipse.emf.ecore.EObject) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException)

Example 77 with ParameterizedTypeRef

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

the class InternalTypeSystem method applyRuleTypeTSetter.

protected Result<TypeRef> applyRuleTypeTSetter(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TSetter tsetter) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    TypeRef _elvis = null;
    TypeRef _declaredTypeRef = tsetter.getDeclaredTypeRef();
    if (_declaredTypeRef != null) {
        _elvis = _declaredTypeRef;
    } else {
        ParameterizedTypeRef _anyTypeRef = RuleEnvironmentExtensions.anyTypeRef(G);
        _elvis = _anyTypeRef;
    }
    T = _elvis;
    return new Result<TypeRef>(T);
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) 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) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 78 with ParameterizedTypeRef

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

the class InternalTypeSystem method applyRuleTypeNumericLiteral.

protected Result<TypeRef> applyRuleTypeNumericLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumericLiteral l) throws RuleFailedException {
    // output parameter
    TypeRef T = null;
    ParameterizedTypeRef _xifexpression = null;
    boolean _isIntLiteral = N4JSLanguageUtils.isIntLiteral(l);
    if (_isIntLiteral) {
        _xifexpression = RuleEnvironmentExtensions.intTypeRef(G);
    } else {
        _xifexpression = RuleEnvironmentExtensions.numberTypeRef(G);
    }
    T = _xifexpression;
    return new Result<TypeRef>(T);
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) 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) Result(org.eclipse.xsemantics.runtime.Result) StructuralTypingResult(org.eclipse.n4js.typesystem.StructuralTypingResult)

Example 79 with ParameterizedTypeRef

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

the class InternalTypeSystem method upperBoundImpl.

protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef ptr) throws RuleFailedException {
    try {
        final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
        final Result<TypeRef> _result_ = applyRuleUpperBoundParameterizedTypeRef(G, _subtrace_, ptr);
        addToTrace(_trace_, new Provider<Object>() {

            public Object get() {
                return ruleName("upperBoundParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(ptr) + " /\\ " + stringRep(_result_.getFirst());
            }
        });
        addAsSubtrace(_trace_, _subtrace_);
        return _result_;
    } catch (Exception e_applyRuleUpperBoundParameterizedTypeRef) {
        upperBoundThrowException(ruleName("upperBoundParameterizedTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(ptr) + " /\\ " + "TypeRef", UPPERBOUNDPARAMETERIZEDTYPEREF, e_applyRuleUpperBoundParameterizedTypeRef, ptr, new ErrorInformation[] { new ErrorInformation(ptr) });
        return null;
    }
}
Also used : ErrorInformation(org.eclipse.xsemantics.runtime.ErrorInformation) 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) RuleApplicationTrace(org.eclipse.xsemantics.runtime.RuleApplicationTrace) EObject(org.eclipse.emf.ecore.EObject) RuleFailedException(org.eclipse.xsemantics.runtime.RuleFailedException)

Example 80 with ParameterizedTypeRef

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

the class InternalTypeSystem method _applyRuleTypeCatchVariable_1.

private ParameterizedTypeRef _applyRuleTypeCatchVariable_1(final RuleEnvironment G, final CatchVariable catchVariable) throws RuleFailedException {
    ParameterizedTypeRef _xifexpression = null;
    boolean _enforceDynamicTypes = this.jsVariantHelper.enforceDynamicTypes(catchVariable);
    if (_enforceDynamicTypes) {
        _xifexpression = RuleEnvironmentExtensions.anyTypeRefDynamic(G);
    } else {
        _xifexpression = RuleEnvironmentExtensions.anyTypeRef(G);
    }
    return _xifexpression;
}
Also used : ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)

Aggregations

ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)80 TypeTypeRef (org.eclipse.n4js.ts.typeRefs.TypeTypeRef)48 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)47 BoundThisTypeRef (org.eclipse.n4js.ts.typeRefs.BoundThisTypeRef)45 ComposedTypeRef (org.eclipse.n4js.ts.typeRefs.ComposedTypeRef)44 ExistentialTypeRef (org.eclipse.n4js.ts.typeRefs.ExistentialTypeRef)44 StructuralTypeRef (org.eclipse.n4js.ts.typeRefs.StructuralTypeRef)44 BaseTypeRef (org.eclipse.n4js.ts.typeRefs.BaseTypeRef)42 FunctionTypeRef (org.eclipse.n4js.ts.typeRefs.FunctionTypeRef)42 ThisTypeRef (org.eclipse.n4js.ts.typeRefs.ThisTypeRef)42 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)42 StaticBaseTypeRef (org.eclipse.n4js.ts.typeRefs.StaticBaseTypeRef)41 RuleFailedException (org.eclipse.xsemantics.runtime.RuleFailedException)32 EObject (org.eclipse.emf.ecore.EObject)30 ErrorInformation (org.eclipse.xsemantics.runtime.ErrorInformation)23 Result (org.eclipse.xsemantics.runtime.Result)23 StructuralTypingResult (org.eclipse.n4js.typesystem.StructuralTypingResult)22 Type (org.eclipse.n4js.ts.types.Type)21 RuleApplicationTrace (org.eclipse.xsemantics.runtime.RuleApplicationTrace)21 ContainerType (org.eclipse.n4js.ts.types.ContainerType)17