use of org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef in project n4js by eclipse.
the class InternalTypeSystem method applyRuleUpperBoundParameterizedTypeRef.
protected Result<TypeRef> applyRuleUpperBoundParameterizedTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ParameterizedTypeRef ptr) throws RuleFailedException {
// output parameter
TypeRef T = null;
Type _declaredType = ptr.getDeclaredType();
if ((_declaredType instanceof TypeVariable)) {
T = ptr;
} else {
T = ptr;
}
return new Result<TypeRef>(T);
}
use of org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef in project n4js by eclipse.
the class BoundThisTypeRefImpl method isDefSiteStructuralTyping.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isDefSiteStructuralTyping() {
ParameterizedTypeRef _actualThisTypeRef = this.getActualThisTypeRef();
if ((_actualThisTypeRef instanceof TN4Classifier)) {
ParameterizedTypeRef _actualThisTypeRef_1 = this.getActualThisTypeRef();
TypingStrategy _typingStrategy = ((TN4Classifier) _actualThisTypeRef_1).getTypingStrategy();
return (_typingStrategy == TypingStrategy.STRUCTURAL);
}
ParameterizedTypeRef _actualThisTypeRef_2 = this.getActualThisTypeRef();
if ((_actualThisTypeRef_2 instanceof TStructuralType)) {
return true;
}
return false;
}
use of org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef in project n4js by eclipse.
the class BoundThisTypeRefImpl method basicSetActualThisTypeRef.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetActualThisTypeRef(ParameterizedTypeRef newActualThisTypeRef, NotificationChain msgs) {
ParameterizedTypeRef oldActualThisTypeRef = actualThisTypeRef;
actualThisTypeRef = newActualThisTypeRef;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypeRefsPackage.BOUND_THIS_TYPE_REF__ACTUAL_THIS_TYPE_REF, oldActualThisTypeRef, newActualThisTypeRef);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef in project n4js by eclipse.
the class FindReferencesXpectMethod method findReferences.
/**
* This Xpect methods compares all computed references at a given EObject to the expected references. The expected
* references include the line number.
*/
@Xpect
@ParameterParser(syntax = "('at' arg1=OFFSET)?")
public void findReferences(@N4JSCommaSeparatedValuesExpectation IN4JSCommaSeparatedValuesExpectation expectation, IEObjectCoveringRegion offset) {
// When you write Xpect test methods, ALWAYS retrieve eObject via IEObjectCoveringRegion to get the right
// eObject!
// Do NOT use EObject arg1!
EObject context = offset.getEObject();
EObject argEObj = offsetHelper.resolveElementAt((XtextResource) context.eResource(), offset.getOffset());
// If not a cross-reference element, use context instead
if (argEObj == null)
argEObj = context;
EObject eObj = argEObj;
if (argEObj instanceof ParameterizedTypeRef)
eObj = ((ParameterizedTypeRef) argEObj).getDeclaredType();
List<EObject> refs = findReferenceHelper.findReferences(eObj);
ArrayList<String> result = Lists.newArrayList();
for (EObject ref : refs) {
if (ref instanceof PropertyNameOwner)
ref = ((PropertyNameOwner) ref).getDeclaredName();
ICompositeNode srcNode = NodeModelUtils.getNode(ref);
int line = srcNode.getStartLine();
String moduleName;
if (ref.eResource() instanceof N4JSResource) {
N4JSResource n4jsResource = (N4JSResource) ref.eResource();
moduleName = n4jsResource.getModule().getQualifiedName();
} else {
moduleName = "(unknown resource)";
}
String text = NodeModelUtils.getTokenText(srcNode);
if (ref instanceof GenericDeclaration)
text = ((GenericDeclaration) ref).getDefinedType().getName();
String resultText = moduleName + " - " + text + " - " + line;
result.add(resultText);
}
expectation.assertEquals(result);
}
use of org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef in project n4js by eclipse.
the class N4ClassDefinitionImpl method basicSetSuperClassRef.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSuperClassRef(ParameterizedTypeRef newSuperClassRef, NotificationChain msgs) {
ParameterizedTypeRef oldSuperClassRef = superClassRef;
superClassRef = newSuperClassRef;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.N4_CLASS_DEFINITION__SUPER_CLASS_REF, oldSuperClassRef, newSuperClassRef);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations