use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleSubstTypeVariablesInTypeTypeRef.
protected Result<TypeArgument> applyRuleSubstTypeVariablesInTypeTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeTypeRef typeRef) throws RuleFailedException {
// output parameter
TypeTypeRef result = null;
/* G |- typeRef.getTypeArg ~> var TypeArgument tResult */
TypeArgument _typeArg = typeRef.getTypeArg();
TypeArgument tResult = null;
Result<TypeArgument> result_1 = substTypeVariablesInternal(G, _trace_, _typeArg);
checkAssignableTo(result_1.getFirst(), TypeArgument.class);
tResult = (TypeArgument) result_1.getFirst();
TypeArgument _typeArg_1 = typeRef.getTypeArg();
boolean _tripleNotEquals = (_typeArg_1 != tResult);
if (_tripleNotEquals) {
tResult = TypeUtils.<TypeArgument>copyIfContained(tResult);
result = TypeUtils.<TypeTypeRef>copyIfContained(typeRef);
result.setTypeArg(tResult);
} else {
result = typeRef;
}
return new Result<TypeArgument>(result);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeFunctionExpression.
protected Result<TypeRef> applyRuleTypeFunctionExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionExpression e) throws RuleFailedException {
// output parameter
TypeRef T = null;
T = this.applyRuleTypeTypeDefiningElement(G, _trace_, e).getValue();
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeTGetter.
protected Result<TypeRef> applyRuleTypeTGetter(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TGetter tgetter) throws RuleFailedException {
// output parameter
TypeRef T = null;
TypeRef _elvis = null;
TypeRef _declaredTypeRef = tgetter.getDeclaredTypeRef();
if (_declaredTypeRef != null) {
_elvis = _declaredTypeRef;
} else {
ParameterizedTypeRef _anyTypeRef = RuleEnvironmentExtensions.anyTypeRef(G);
_elvis = _anyTypeRef;
}
T = _elvis;
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleTypeModuleNamespace.
protected Result<TypeRef> applyRuleTypeModuleNamespace(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModuleNamespaceVirtualType t) throws RuleFailedException {
// output parameter
TypeRef T = null;
T = TypeUtils.createTypeRef(t);
return new Result<TypeRef>(T);
}
use of org.eclipse.xsemantics.runtime.Result in project n4js by eclipse.
the class InternalTypeSystem method applyRuleSubtypeExistentialTypeRef_Right.
protected Result<Boolean> applyRuleSubtypeExistentialTypeRef_Right(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
boolean _isExistentialTypeToBeReopened = RuleEnvironmentExtensions.isExistentialTypeToBeReopened(G, existentialTypeRef);
if (_isExistentialTypeToBeReopened) {
final Wildcard wildThing = existentialTypeRef.getWildcard();
/* G |~ wildThing /\ var TypeRef upperBound */
TypeRef upperBound = null;
Result<TypeRef> result = upperBoundInternal(G, _trace_, wildThing);
checkAssignableTo(result.getFirst(), TypeRef.class);
upperBound = (TypeRef) result.getFirst();
/* G |~ wildThing \/ var TypeRef lowerBound */
TypeRef lowerBound = null;
Result<TypeRef> result_1 = lowerBoundInternal(G, _trace_, wildThing);
checkAssignableTo(result_1.getFirst(), TypeRef.class);
lowerBound = (TypeRef) result_1.getFirst();
/* G |- left <: upperBound */
subtypeInternal(G, _trace_, left, upperBound);
/* G |- lowerBound <: left */
subtypeInternal(G, _trace_, lowerBound, left);
} else {
/* left===existentialTypeRef or { left instanceof ParameterizedTypeRef && (left as ParameterizedTypeRef).declaredType instanceof NullType } or { G |~ existentialTypeRef \/ var TypeRef lowerExt G |- left <: lowerExt } */
{
RuleFailedException previousFailure = null;
try {
/* left===existentialTypeRef */
if (!(left == existentialTypeRef)) {
sneakyThrowRuleFailedException("left===existentialTypeRef");
}
} catch (Exception e) {
previousFailure = extractRuleFailedException(e);
/* { left instanceof ParameterizedTypeRef && (left as ParameterizedTypeRef).declaredType instanceof NullType } or { G |~ existentialTypeRef \/ var TypeRef lowerExt G |- left <: lowerExt } */
{
try {
/* left instanceof ParameterizedTypeRef && (left as ParameterizedTypeRef).declaredType instanceof NullType */
if (!((left instanceof ParameterizedTypeRef) && (((ParameterizedTypeRef) left).getDeclaredType() instanceof NullType))) {
sneakyThrowRuleFailedException("left instanceof ParameterizedTypeRef && (left as ParameterizedTypeRef).declaredType instanceof NullType");
}
} catch (Exception e_1) {
previousFailure = extractRuleFailedException(e_1);
/* G |~ existentialTypeRef \/ var TypeRef lowerExt */
TypeRef lowerExt = null;
Result<TypeRef> result_2 = lowerBoundInternal(G, _trace_, existentialTypeRef);
checkAssignableTo(result_2.getFirst(), TypeRef.class);
lowerExt = (TypeRef) result_2.getFirst();
/* G |- left <: lowerExt */
subtypeInternal(G, _trace_, left, lowerExt);
}
}
}
}
}
return new Result<Boolean>(true);
}
Aggregations