use of org.eclipse.n4js.ts.types.TypeVariable in project n4js by eclipse.
the class FunctionTypeExpressionImpl method getTypeVars.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<TypeVariable> getTypeVars() {
EList<TypeVariable> _xifexpression = null;
boolean _isBinding = this.isBinding();
if (_isBinding) {
_xifexpression = this.getUnboundTypeVars();
} else {
EList<TypeVariable> _xifexpression_1 = null;
TFunction _declaredType = this.getDeclaredType();
boolean _tripleNotEquals = (_declaredType != null);
if (_tripleNotEquals) {
_xifexpression_1 = this.getDeclaredType().getTypeVars();
} else {
_xifexpression_1 = this.getOwnedTypeVars();
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
use of org.eclipse.n4js.ts.types.TypeVariable in project n4js by eclipse.
the class WildcardImpl method getDeclaredOrImplicitUpperBound.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeRef getDeclaredOrImplicitUpperBound() {
final TypeRef declUB = this.getDeclaredUpperBound();
if ((declUB != null)) {
return declUB;
}
TypeRef _declaredLowerBound = this.getDeclaredLowerBound();
boolean _tripleNotEquals = (_declaredLowerBound != null);
if (_tripleNotEquals) {
return null;
}
final EObject parent = this.eContainer();
if ((parent instanceof ParameterizedTypeRef)) {
final int typeArgIndex = ((ParameterizedTypeRef) parent).getTypeArgs().indexOf(this);
if ((typeArgIndex >= 0)) {
final Object declType = ((ParameterizedTypeRef) parent).eGet(TypeRefsPackage.eINSTANCE.getParameterizedTypeRef_DeclaredType(), false);
if ((declType instanceof ContainerType<?>)) {
boolean _eIsProxy = ((ContainerType<?>) declType).eIsProxy();
boolean _not = (!_eIsProxy);
if (_not) {
final EList<TypeVariable> typeVars = ((ContainerType<?>) declType).getTypeVars();
TypeVariable _xifexpression = null;
int _size = typeVars.size();
boolean _lessThan = (typeArgIndex < _size);
if (_lessThan) {
_xifexpression = typeVars.get(typeArgIndex);
} else {
_xifexpression = null;
}
final TypeVariable typeVar = _xifexpression;
if ((typeVar != null)) {
final TypeRef implicitUB = typeVar.getDeclaredUpperBound();
return implicitUB;
}
}
}
}
}
return null;
}
use of org.eclipse.n4js.ts.types.TypeVariable in project n4js by eclipse.
the class TypeVariableMappingImpl method setTypeVar.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTypeVar(TypeVariable newTypeVar) {
TypeVariable oldTypeVar = typeVar;
typeVar = newTypeVar;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypeRefsPackage.TYPE_VARIABLE_MAPPING__TYPE_VAR, oldTypeVar, typeVar));
}
use of org.eclipse.n4js.ts.types.TypeVariable in project n4js by eclipse.
the class TMethodImpl method getFunctionAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFunctionAsString() {
final StringBuilder strb = new StringBuilder();
boolean _isGeneric = this.isGeneric();
if (_isGeneric) {
final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
public String apply(final TypeVariable it) {
return it.getTypeAsString();
}
};
strb.append("<").append(IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",")).append("> ");
}
boolean _isDeclaredAsync = this.isDeclaredAsync();
if (_isDeclaredAsync) {
strb.append("async ");
}
final Function1<TFormalParameter, String> _function_1 = new Function1<TFormalParameter, String>() {
public String apply(final TFormalParameter it) {
return it.getFormalParameterAsString();
}
};
strb.append(this.getName()).append("(").append(IterableExtensions.join(XcoreEListExtensions.<TFormalParameter, String>map(this.getFpars(), _function_1), ", ")).append(")");
TypeRef _returnTypeRef = this.getReturnTypeRef();
boolean _tripleNotEquals = (_returnTypeRef != null);
if (_tripleNotEquals) {
strb.append(": ").append(this.getReturnTypeRef().getTypeRefAsString());
}
boolean _isReturnValueOptional = this.isReturnValueOptional();
if (_isReturnValueOptional) {
strb.append("?");
}
return strb.toString();
}
use of org.eclipse.n4js.ts.types.TypeVariable in project n4js by eclipse.
the class TFunctionImpl method getFunctionAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFunctionAsString() {
final StringBuilder strb = new StringBuilder();
boolean _isGeneric = this.isGeneric();
if (_isGeneric) {
final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
public String apply(final TypeVariable it) {
return it.getTypeAsString();
}
};
strb.append("<").append(IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",")).append("> ");
}
boolean _isDeclaredAsync = this.isDeclaredAsync();
if (_isDeclaredAsync) {
strb.append("async ");
}
strb.append("function ");
boolean _isDeclaredGenerator = this.isDeclaredGenerator();
if (_isDeclaredGenerator) {
strb.append("* ");
}
final Function1<TFormalParameter, String> _function_1 = new Function1<TFormalParameter, String>() {
public String apply(final TFormalParameter it) {
return it.getFormalParameterAsString();
}
};
strb.append(this.getName()).append("(").append(IterableExtensions.join(XcoreEListExtensions.<TFormalParameter, String>map(this.getFpars(), _function_1), ", ")).append(")");
TypeRef _returnTypeRef = this.getReturnTypeRef();
boolean _tripleNotEquals = (_returnTypeRef != null);
if (_tripleNotEquals) {
strb.append(": ").append(this.getReturnTypeRef().getTypeRefAsString());
}
boolean _isReturnValueOptional = this.isReturnValueOptional();
if (_isReturnValueOptional) {
strb.append("?");
}
return strb.toString();
}
Aggregations