use of org.eclipse.n4js.ts.typeRefs.TypeArgument in project n4js by eclipse.
the class TypeUtils method createClassifierBoundThisTypeRef.
/**
* from type{S} to type{this[S]}, as Part of IDE-785
*
* @param actualThisTypeRef
* must not be null, must not contain a this unbound-this-type-ref.
*/
public static TypeTypeRef createClassifierBoundThisTypeRef(TypeTypeRef actualThisTypeRef) {
if (actualThisTypeRef == null) {
throw new NullPointerException("Actual this type must not be null!");
}
TypeArgument typeArg = actualThisTypeRef.getTypeArg();
final BoundThisTypeRef boundThisTypeRef;
if (typeArg instanceof ParameterizedTypeRef) {
boundThisTypeRef = createBoundThisTypeRef((ParameterizedTypeRef) typeArg);
} else if (typeArg instanceof BoundThisTypeRef) {
boundThisTypeRef = (BoundThisTypeRef) typeArg;
} else {
// invalid use
throw new IllegalArgumentException("Cannot turn unbound type{this} into type{this[X]}, must be called with type{X}!");
}
TypeTypeRef classifierBoundThisTypeRef = createTypeTypeRef(boundThisTypeRef, false);
// TODO is there anything else to copy ?
return classifierBoundThisTypeRef;
}
use of org.eclipse.n4js.ts.typeRefs.TypeArgument in project n4js by eclipse.
the class ParameterizedTypeRefStructuralImpl method getTypeRefAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTypeRefAsString() {
TypingStrategy _typingStrategy = this.getTypingStrategy();
Type _declaredType = this.getDeclaredType();
String _rawTypeAsString = null;
if (_declaredType != null) {
_rawTypeAsString = _declaredType.getRawTypeAsString();
}
String _plus = (_typingStrategy + _rawTypeAsString);
String _xifexpression = null;
boolean _isEmpty = this.getTypeArgs().isEmpty();
if (_isEmpty) {
_xifexpression = "";
} else {
final Function1<TypeArgument, String> _function = new Function1<TypeArgument, String>() {
public String apply(final TypeArgument it) {
return it.getTypeRefAsString();
}
};
String _join = IterableExtensions.join(XcoreEListExtensions.<TypeArgument, String>map(this.getTypeArgs(), _function), ",");
String _plus_1 = ("<" + _join);
_xifexpression = (_plus_1 + ">");
}
String _plus_2 = (_plus + _xifexpression);
String _xifexpression_1 = null;
boolean _isEmpty_1 = this.getStructuralMembers().isEmpty();
if (_isEmpty_1) {
_xifexpression_1 = "";
} else {
final Function1<TStructMember, String> _function_1 = new Function1<TStructMember, String>() {
public String apply(final TStructMember it) {
return it.getMemberAsString();
}
};
String _join_1 = IterableExtensions.join(XcoreEListExtensions.<TStructMember, String>map(this.getStructuralMembers(), _function_1), "; ");
String _plus_3 = (" with { " + _join_1);
String _plus_4 = (_plus_3 + " }");
String _xifexpression_2 = null;
boolean _isEmpty_2 = this.getPostponedSubstitutions().isEmpty();
if (_isEmpty_2) {
_xifexpression_2 = "";
} else {
final Function1<TypeVariableMapping, String> _function_2 = new Function1<TypeVariableMapping, String>() {
public String apply(final TypeVariableMapping it) {
String _typeAsString = it.getTypeVar().getTypeAsString();
String _plus = (_typeAsString + "->");
String _typeRefAsString = it.getTypeArg().getTypeRefAsString();
return (_plus + _typeRefAsString);
}
};
String _join_2 = IterableExtensions.join(XcoreEListExtensions.<TypeVariableMapping, String>map(this.getPostponedSubstitutions(), _function_2), ", ");
String _plus_5 = (" [[" + _join_2);
_xifexpression_2 = (_plus_5 + "]]");
}
_xifexpression_1 = (_plus_4 + _xifexpression_2);
}
return (_plus_2 + _xifexpression_1);
}
use of org.eclipse.n4js.ts.typeRefs.TypeArgument in project n4js by eclipse.
the class TypeVariableMappingImpl method basicSetTypeArg.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTypeArg(TypeArgument newTypeArg, NotificationChain msgs) {
TypeArgument oldTypeArg = typeArg;
typeArg = newTypeArg;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypeRefsPackage.TYPE_VARIABLE_MAPPING__TYPE_ARG, oldTypeArg, newTypeArg);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.ts.typeRefs.TypeArgument in project n4js by eclipse.
the class TypeTypeRefImpl method basicSetTypeArg.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTypeArg(TypeArgument newTypeArg, NotificationChain msgs) {
TypeArgument oldTypeArg = typeArg;
typeArg = newTypeArg;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypeRefsPackage.TYPE_TYPE_REF__TYPE_ARG, oldTypeArg, newTypeArg);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.ts.typeRefs.TypeArgument in project n4js by eclipse.
the class TypeTypeRefImpl method getTypeRefAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTypeRefAsString() {
String _xifexpression = null;
boolean _isConstructorRef = this.isConstructorRef();
if (_isConstructorRef) {
_xifexpression = "constructor";
} else {
_xifexpression = "type";
}
final String kwd = _xifexpression;
String _xifexpression_1 = null;
TypeArgument _typeArg = this.getTypeArg();
boolean _tripleEquals = (null == _typeArg);
if (_tripleEquals) {
_xifexpression_1 = "";
} else {
_xifexpression_1 = this.getTypeArg().getTypeRefAsString();
}
final String refName = _xifexpression_1;
String _modifiersAsString = this.getModifiersAsString();
return ((((kwd + "{") + refName) + "}") + _modifiersAsString);
}
Aggregations