Search in sources :

Example 1 with IReferenceableElement

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

the class ASN1_Set_Seq_Choice_BaseType method resolveReference.

@Override
public /**
 * {@inheritDoc}
 */
Declaration resolveReference(final Reference reference, final int subRefIdx, final ISubReference lastSubreference) {
    final List<ISubReference> subreferences = reference.getSubreferences();
    int actualIndex = subRefIdx;
    while (actualIndex < subreferences.size() && subreferences.get(actualIndex) instanceof ArraySubReference) {
        ++actualIndex;
    }
    if (actualIndex == subreferences.size()) {
        return null;
    }
    final Identifier fieldID = subreferences.get(actualIndex).getId();
    if (subreferences.get(actualIndex) == lastSubreference) {
        return Declaration.createInstance(getDefiningAssignment(), fieldID);
    }
    final CompField compField = getComponentByName(fieldID);
    final IType compFieldType = compField.getType().getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (compFieldType instanceof IReferenceableElement) {
        final Declaration decl = ((IReferenceableElement) compFieldType).resolveReference(reference, actualIndex + 1, lastSubreference);
        return decl != null ? decl : Declaration.createInstance(getDefiningAssignment(), compField.getIdentifier());
    }
    return null;
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) Identifier(org.eclipse.titan.designer.AST.Identifier) CompField(org.eclipse.titan.designer.AST.TTCN3.types.CompField) Declaration(org.eclipse.titan.designer.declarationsearch.Declaration) IReferenceableElement(org.eclipse.titan.designer.AST.IReferenceableElement) ArraySubReference(org.eclipse.titan.designer.AST.ArraySubReference) IType(org.eclipse.titan.designer.AST.IType)

Example 2 with IReferenceableElement

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

the class TTCN3_Set_Seq_Choice_BaseType method resolveReference.

@Override
public /**
 * {@inheritDoc}
 */
Declaration resolveReference(final Reference reference, final int subRefIdx, final ISubReference lastSubreference) {
    final List<ISubReference> subreferences = reference.getSubreferences();
    int localIndex = subRefIdx;
    while (localIndex < subreferences.size() && subreferences.get(localIndex) instanceof ArraySubReference) {
        ++localIndex;
    }
    if (localIndex == subreferences.size()) {
        return null;
    }
    final CompField compField = getComponentByName(subreferences.get(localIndex).getId().getName());
    if (compField == null) {
        return null;
    }
    if (subreferences.get(localIndex) == lastSubreference) {
        return Declaration.createInstance(getDefiningAssignment(), compField.getIdentifier());
    }
    final IType compFieldType = compField.getType().getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (compFieldType instanceof IReferenceableElement) {
        final Declaration decl = ((IReferenceableElement) compFieldType).resolveReference(reference, localIndex + 1, lastSubreference);
        return decl != null ? decl : Declaration.createInstance(getDefiningAssignment(), compField.getIdentifier());
    }
    return null;
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) Declaration(org.eclipse.titan.designer.declarationsearch.Declaration) IReferenceableElement(org.eclipse.titan.designer.AST.IReferenceableElement) ArraySubReference(org.eclipse.titan.designer.AST.ArraySubReference) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)2 IReferenceableElement (org.eclipse.titan.designer.AST.IReferenceableElement)2 ISubReference (org.eclipse.titan.designer.AST.ISubReference)2 IType (org.eclipse.titan.designer.AST.IType)2 Declaration (org.eclipse.titan.designer.declarationsearch.Declaration)2 Identifier (org.eclipse.titan.designer.AST.Identifier)1 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)1