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 ArrayPadding p) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleTypeArrayPadding(G, _subtrace_, p);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("typeArrayPadding") + stringRepForEnv(G) + " |- " + stringRep(p) + " : " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleTypeArrayPadding) {
typeThrowException(ruleName("typeArrayPadding") + stringRepForEnv(G) + " |- " + stringRep(p) + " : " + "ParameterizedTypeRef", TYPEARRAYPADDING, e_applyRuleTypeArrayPadding, p, new ErrorInformation[] { new ErrorInformation(p) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef in project n4js by eclipse.
the class InternalTypeSystem method lowerBoundImpl.
protected Result<TypeRef> lowerBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final Wildcard wildcard) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleLowerBoundWildcard(G, _subtrace_, wildcard);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("lowerBoundWildcard") + stringRepForEnv(G) + " |~ " + stringRep(wildcard) + " \\/ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleLowerBoundWildcard) {
lowerBoundThrowException(ruleName("lowerBoundWildcard") + stringRepForEnv(G) + " |~ " + stringRep(wildcard) + " \\/ " + "TypeRef", LOWERBOUNDWILDCARD, e_applyRuleLowerBoundWildcard, wildcard, new ErrorInformation[] { new ErrorInformation(wildcard) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef 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.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 UnionTypeExpression U) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleUpperBoundUnionTypeExpression(G, _subtrace_, U);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("upperBoundUnionTypeExpression") + stringRepForEnv(G) + " |~ " + stringRep(U) + " /\\ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleUpperBoundUnionTypeExpression) {
upperBoundThrowException(ruleName("upperBoundUnionTypeExpression") + stringRepForEnv(G) + " |~ " + stringRep(U) + " /\\ " + "TypeRef", UPPERBOUNDUNIONTYPEEXPRESSION, e_applyRuleUpperBoundUnionTypeExpression, U, new ErrorInformation[] { new ErrorInformation(U) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.TypeRef 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);
}
Aggregations