use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleUpperBoundIntersectionTypeExpression.
protected Result<TypeRef> applyRuleUpperBoundIntersectionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntersectionTypeExpression I) 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.createNonSimplifiedIntersectionType(ListExtensions.<TypeRef, TypeRef>map(I.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, I);
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeArrayElement.
protected Result<TypeRef> applyRuleTypeArrayElement(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ArrayElement e) throws RuleFailedException {
// output parameter
TypeRef T = null;
/* G |- e.expression: T */
Expression _expression = e.getExpression();
Result<TypeRef> result = typeInternal(G, _trace_, _expression);
checkAssignableTo(result.getFirst(), TypeRef.class);
T = (TypeRef) result.getFirst();
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypePropertyNameValuePair.
protected Result<TypeRef> applyRuleTypePropertyNameValuePair(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyNameValuePair property) throws RuleFailedException {
// output parameter
TypeRef T = null;
TypeRef _declaredTypeRef = property.getDeclaredTypeRef();
boolean _tripleNotEquals = (_declaredTypeRef != null);
if (_tripleNotEquals) {
T = property.getDeclaredTypeRef();
} else {
Expression _expression = property.getExpression();
boolean _tripleNotEquals_1 = (_expression != null);
if (_tripleNotEquals_1) {
/* G |- property.expression: var TypeRef E */
Expression _expression_1 = property.getExpression();
TypeRef E = null;
Result<TypeRef> result = typeInternal(G, _trace_, _expression_1);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
/* G |~ E /\ E */
Result<TypeRef> result_1 = upperBoundInternal(G, _trace_, E);
checkAssignableTo(result_1.getFirst(), TypeRef.class);
E = (TypeRef) result_1.getFirst();
if ((((E.getDeclaredType() == RuleEnvironmentExtensions.undefinedType(G)) || (E.getDeclaredType() == RuleEnvironmentExtensions.nullType(G))) || (E.getDeclaredType() == RuleEnvironmentExtensions.voidType(G)))) {
T = RuleEnvironmentExtensions.anyTypeRef(G);
} else {
T = E;
}
} else {
T = RuleEnvironmentExtensions.anyTypeRef(G);
}
}
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeObjectLiteral.
protected Result<TypeRef> applyRuleTypeObjectLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ObjectLiteral ol) throws RuleFailedException {
// output parameter
TypeRef T = null;
final ParameterizedTypeRefStructural ptr = TypeRefsFactory.eINSTANCE.createParameterizedTypeRefStructural();
ptr.setDeclaredType(RuleEnvironmentExtensions.objectType(G));
Type _definedType = ol.getDefinedType();
ptr.setStructuralType(((TStructuralType) _definedType));
ptr.setDefinedTypingStrategy(TypingStrategy.STRUCTURAL);
T = ptr;
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeCastExpression.
protected Result<TypeRef> applyRuleTypeCastExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final CastExpression e) throws RuleFailedException {
// output parameter
TypeRef T = null;
T = e.getTargetTypeRef();
return new Result<TypeRef>(T);
}
Aggregations