use of org.eclipse.n4js.ts.typeRefs.FunctionTypeRef in project n4js by eclipse.
the class InternalTypeSystem method lowerBoundImpl.
protected Result<TypeRef> lowerBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionTypeRef F) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleLowerBoundFunctionTypeRef(G, _subtrace_, F);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("lowerBoundFunctionTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(F) + " \\/ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleLowerBoundFunctionTypeRef) {
lowerBoundThrowException(ruleName("lowerBoundFunctionTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(F) + " \\/ " + "TypeRef", LOWERBOUNDFUNCTIONTYPEREF, e_applyRuleLowerBoundFunctionTypeRef, F, new ErrorInformation[] { new ErrorInformation(F) });
return null;
}
}
use of org.eclipse.n4js.ts.typeRefs.FunctionTypeRef in project n4js by eclipse.
the class InternalTypeSystem method applyRuleSubstTypeVariablesInFunctionTypeRef.
protected Result<TypeArgument> applyRuleSubstTypeVariablesInFunctionTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionTypeRef typeRef) throws RuleFailedException {
// output parameter
TypeRef result = null;
TypeArgument _value = this.applyRuleSubstTypeVariablesInFunctionTypeExprOrRef(G, _trace_, typeRef).getValue();
result = ((TypeRef) _value);
return new Result<TypeArgument>(result);
}
use of org.eclipse.n4js.ts.typeRefs.FunctionTypeRef in project n4js by eclipse.
the class InternalTypeSystem method applyRuleLowerBoundFunctionTypeRef.
protected Result<TypeRef> applyRuleLowerBoundFunctionTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionTypeRef F) throws RuleFailedException {
// output parameter
TypeRef T = null;
T = this.applyRuleLowerBoundFunctionTypeExprOrRef(G, _trace_, F).getValue();
return new Result<TypeRef>(T);
}
use of org.eclipse.n4js.ts.typeRefs.FunctionTypeRef in project n4js by eclipse.
the class TypeUtils method createConstructorTypeRef.
/**
* Creates new type reference for constructor. if the declared type is TFunction a FunctionTypeRef is created. If
* declared type is TClassifier than TypeTypeRef is created (i.e. <code>constructor{A}</code> in N4JS code)
*/
public static TypeRef createConstructorTypeRef(Type declaredType, TypeArgument... typeArgs) {
TypeRef typeRef = null;
if (declaredType instanceof TFunction) {
// TODO is this correct?
FunctionTypeRef ref = TypeRefsFactory.eINSTANCE.createFunctionTypeRef();
ref.setDeclaredType(declaredType);
for (TypeArgument typeArg : typeArgs) {
ref.getTypeArgs().add(TypeUtils.copyIfContained(typeArg));
}
typeRef = ref;
} else if (declaredType instanceof TClassifier) {
TClassifier tClassifier = (TClassifier) declaredType;
typeRef = createTypeTypeRef(createTypeRef(tClassifier, typeArgs), true);
} else if (declaredType instanceof TypeVariable) {
TypeVariable tTypeVar = (TypeVariable) declaredType;
typeRef = createTypeTypeRef(createTypeRef(tTypeVar), true);
}
return typeRef;
}
use of org.eclipse.n4js.ts.typeRefs.FunctionTypeRef in project n4js by eclipse.
the class InternalTypeSystem method upperBoundImpl.
protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FunctionTypeRef F) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleUpperBoundFunctionTypeRef(G, _subtrace_, F);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("upperBoundFunctionTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(F) + " /\\ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleUpperBoundFunctionTypeRef) {
upperBoundThrowException(ruleName("upperBoundFunctionTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(F) + " /\\ " + "TypeRef", UPPERBOUNDFUNCTIONTYPEREF, e_applyRuleUpperBoundFunctionTypeRef, F, new ErrorInformation[] { new ErrorInformation(F) });
return null;
}
}
Aggregations