use of org.eclipse.xsemantics.runtime.Result 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);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeNewExpression.
protected Result<TypeRef> applyRuleTypeNewExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NewExpression e) throws RuleFailedException {
// output parameter
TypeRef T = null;
/* G |- e.callee: T */
Expression _callee = e.getCallee();
Result<TypeRef> result = typeInternal(G, _trace_, _callee);
checkAssignableTo(result.getFirst(), TypeRef.class);
T = (TypeRef) result.getFirst();
if ((T instanceof TypeTypeRef)) {
T = this.typeSystemHelper.createTypeRefFromStaticType(G, ((TypeTypeRef) T), ((TypeArgument[]) Conversions.unwrapArray(e.getTypeArgs(), TypeArgument.class)));
}
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleUpperBoundUnionTypeExpression.
protected Result<TypeRef> applyRuleUpperBoundUnionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnionTypeExpression U) throws RuleFailedException {
// output parameter
TypeRef T = null;
final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
TypeRef _xblockexpression = null;
{
TypeRef E = null;
/* G|~ it /\ E */
Result<TypeRef> result = upperBoundInternal(G, _trace_, it);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
_xblockexpression = E;
}
return _xblockexpression;
};
T = TypeUtils.createNonSimplifiedUnionType(ListExtensions.<TypeRef, TypeRef>map(U.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, U);
return new Result<TypeRef>(T);
}
Aggregations