use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class ComposedMemberInfo method handleValidationProblems.
private void handleValidationProblems() {
for (Pair<TMember, RuleEnvironment> pair : siblings) {
if (pair == null)
continue;
TMember member = pair.getKey();
if (member instanceof TMethod) {
TMethod tMethod = (TMethod) member;
for (int i = 0; i < tMethod.getFpars().size(); i++) {
TFormalParameter currFP = tMethod.getFpars().get(i);
if (currFP.isVariadic() && tMethod.getFpars().size() > i + 1) {
ComposedFParInfo currFPA = fParameters.get(i);
currFPA.hasValidationProblem = true;
return;
}
}
}
}
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class ComposedMemberInfo method initFParAggregate.
private void initFParAggregate(ComposedFParInfo fpAggr) {
for (Pair<TFormalParameter, RuleEnvironment> fpPair : fpAggr.fpSiblings) {
TFormalParameter tFpar = fpPair.getKey();
RuleEnvironment G = fpPair.getValue();
// handle: name
final String nextName = tFpar.getName();
if (nextName != null && !fpAggr.names.contains(nextName)) {
fpAggr.names.add(nextName);
}
// handle: typeRef lists
TypeRef typeRefSubst = ts.substTypeVariablesInTypeRef(G, tFpar.getTypeRef());
if (typeRefSubst != null && !(typeRefSubst instanceof UnknownTypeRef)) {
TypeRef typeRefCopy = TypeUtils.copyIfContained(typeRefSubst);
fpAggr.typeRefs.add(typeRefCopy);
if (tFpar.isVariadic()) {
fpAggr.typeRefsVariadic.add(typeRefCopy);
}
}
// handle: optional
fpAggr.allOptional &= tFpar.isOptional();
fpAggr.allNonOptional &= !tFpar.isOptional();
}
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class ComposedMemberInfo method handleFParameters.
private void handleFParameters(TMember member, RuleEnvironment G) {
EList<TFormalParameter> fpars = null;
if (member instanceof TMethod) {
TMethod method = (TMethod) member;
fpars = method.getFpars();
}
if (member instanceof TSetter) {
TSetter setter = (TSetter) member;
fpars = new BasicEList<>();
fpars.add(setter.getFpar());
}
if (fpars != null) {
for (int i = 0; i < fpars.size(); i++) {
TFormalParameter fpar = fpars.get(i);
if (fParameters.size() <= i) {
fParameters.add(new ComposedFParInfo());
}
ComposedFParInfo fpAggr = fParameters.get(i);
Pair<TFormalParameter, RuleEnvironment> fpPair = new Pair<>(fpar, G);
fpAggr.fpSiblings.add(fpPair);
}
}
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class TSetterImpl method getDeclaredTypeRef.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeRef getDeclaredTypeRef() {
TFormalParameter _fpar = this.getFpar();
TypeRef _typeRef = null;
if (_fpar != null) {
_typeRef = _fpar.getTypeRef();
}
return _typeRef;
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class TSetterImpl method basicSetFpar.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFpar(TFormalParameter newFpar, NotificationChain msgs) {
TFormalParameter oldFpar = fpar;
fpar = newFpar;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypesPackage.TSETTER__FPAR, oldFpar, newFpar);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations