Search in sources :

Example 1 with CachedReferenceChain

use of org.eclipse.titan.designer.AST.CachedReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class TTCN3_Choice_Type method checkRecursions.

@Override
public /**
 * {@inheritDoc}
 */
void checkRecursions(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
    if (!referenceChain.add(this) || compFieldMap.isEmpty()) {
        return;
    }
    // FIXME there should be a better way than checking for all possible IReferenceChain implementation
    CachedReferenceChain cachedChain;
    if (referenceChain instanceof CachedReferenceChain) {
        cachedChain = (CachedReferenceChain) referenceChain;
    } else {
        if (!(referenceChain instanceof ReferenceChain)) {
            return;
        }
        cachedChain = ((ReferenceChain) referenceChain).toCachedReferenceChain();
    }
    final Map<String, CompField> map = compFieldMap.getComponentFieldMap(timestamp);
    cachedChain.markErrorState();
    int i = 1;
    for (final CompField compField : map.values()) {
        final IType type = compField.getType();
        if (type != null) {
            cachedChain.markState();
            type.checkRecursions(timestamp, cachedChain);
            cachedChain.previousState();
        }
        if (cachedChain.getNofErrors() < i) {
            break;
        }
        ++i;
    }
    if (cachedChain.getNofErrors() == map.size()) {
        cachedChain.reportAllTheErrors();
    }
    cachedChain.prevErrorState();
}
Also used : CachedReferenceChain(org.eclipse.titan.designer.AST.CachedReferenceChain) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ReferenceChain(org.eclipse.titan.designer.AST.ReferenceChain) CachedReferenceChain(org.eclipse.titan.designer.AST.CachedReferenceChain) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

CachedReferenceChain (org.eclipse.titan.designer.AST.CachedReferenceChain)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 IType (org.eclipse.titan.designer.AST.IType)1 ReferenceChain (org.eclipse.titan.designer.AST.ReferenceChain)1