use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method _applyRuleTypeTypeDefiningElement_1.
private TypeRef _applyRuleTypeTypeDefiningElement_1(final RuleEnvironment G, final TypeDefiningElement elem) throws RuleFailedException {
TypeRef _elvis = null;
TypeRef _wrapTypeInTypeRef = TypeUtils.wrapTypeInTypeRef(elem.getDefinedType());
if (_wrapTypeInTypeRef != null) {
_elvis = _wrapTypeInTypeRef;
} else {
UnknownTypeRef _createUnknownTypeRef = TypeRefsFactory.eINSTANCE.createUnknownTypeRef();
_elvis = _createUnknownTypeRef;
}
return _elvis;
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method upperBoundImpl.
protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleUpperBoundExistentialTypeRef(G, _subtrace_, existentialTypeRef);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleUpperBoundExistentialTypeRef) {
upperBoundThrowException(ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + "TypeRef", UPPERBOUNDEXISTENTIALTYPEREF, e_applyRuleUpperBoundExistentialTypeRef, existentialTypeRef, new ErrorInformation[] { new ErrorInformation(existentialTypeRef) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method typeImpl.
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final LocalArgumentsVariable lArgumentsVar) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleTypeLocalArgumentsVariable(G, _subtrace_, lArgumentsVar);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("typeLocalArgumentsVariable") + stringRepForEnv(G) + " |- " + stringRep(lArgumentsVar) + " : " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleTypeLocalArgumentsVariable) {
typeThrowException(ruleName("typeLocalArgumentsVariable") + stringRepForEnv(G) + " |- " + stringRep(lArgumentsVar) + " : " + "ParameterizedTypeRef", TYPELOCALARGUMENTSVARIABLE, e_applyRuleTypeLocalArgumentsVariable, lArgumentsVar, new ErrorInformation[] { new ErrorInformation(lArgumentsVar) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method applyRuleLowerBoundExistentialTypeRef.
protected Result<TypeRef> applyRuleLowerBoundExistentialTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
// output parameter
TypeRef T = null;
/* G |~ existentialTypeRef.wildcard \/ T */
Wildcard _wildcard = existentialTypeRef.getWildcard();
Result<TypeRef> result = lowerBoundInternal(G, _trace_, _wildcard);
checkAssignableTo(result.getFirst(), TypeRef.class);
T = (TypeRef) result.getFirst();
T = TypeUtils.<TypeRef>copy(T);
TypeUtils.copyTypeModifiers(T, existentialTypeRef);
return new Result<TypeRef>(T);
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method expectedTypeInImpl.
protected Result<TypeRef> expectedTypeInImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyNameValuePair pnvp, final Expression rhs) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleExpectedTypeOfRightSideInPropertyNameValuePair(G, _subtrace_, pnvp, rhs);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("expectedTypeOfRightSideInPropertyNameValuePair") + stringRepForEnv(G) + " |- " + stringRep(pnvp) + " |> " + stringRep(rhs) + " : " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleExpectedTypeOfRightSideInPropertyNameValuePair) {
expectedTypeInThrowException(ruleName("expectedTypeOfRightSideInPropertyNameValuePair") + stringRepForEnv(G) + " |- " + stringRep(pnvp) + " |> " + stringRep(rhs) + " : " + "TypeRef", EXPECTEDTYPEOFRIGHTSIDEINPROPERTYNAMEVALUEPAIR, e_applyRuleExpectedTypeOfRightSideInPropertyNameValuePair, pnvp, rhs, new ErrorInformation[] { new ErrorInformation(pnvp), new ErrorInformation(rhs) });
return null;
}
}
Aggregations