Search in sources :

Example 36 with ISubReference

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

the class ASN1_Sequence_Type method isPresentAnyvalueEmbeddedField.

@Override
public /**
 * {@inheritDoc}
 */
boolean isPresentAnyvalueEmbeddedField(final ExpressionStruct expression, final List<ISubReference> subreferences, final int beginIndex) {
    if (subreferences == null || getIsErroneous(CompilationTimeStamp.getBaseTimestamp())) {
        return true;
    }
    if (beginIndex >= subreferences.size()) {
        return true;
    }
    final ISubReference subReference = subreferences.get(beginIndex);
    if (!(subReference instanceof FieldSubReference)) {
        ErrorReporter.INTERNAL_ERROR("Code generator reached erroneous type reference `" + getFullName() + "''");
        expression.expression.append("FATAL_ERROR encountered");
        return true;
    }
    final Identifier fieldId = ((FieldSubReference) subReference).getId();
    final CompField compField = getComponentByName(fieldId);
    if (compField.isOptional()) {
        return false;
    }
    return compField.getType().isPresentAnyvalueEmbeddedField(expression, subreferences, beginIndex + 1);
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) Identifier(org.eclipse.titan.designer.AST.Identifier) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) CompField(org.eclipse.titan.designer.AST.TTCN3.types.CompField)

Example 37 with ISubReference

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

the class ASN1_Set_Seq_Choice_BaseType method getFieldTypesAsArray.

@Override
public /**
 * {@inheritDoc}
 */
boolean getFieldTypesAsArray(final Reference reference, final int actualSubReference, final List<IType> typeArray) {
    final List<ISubReference> subreferences = reference.getSubreferences();
    if (subreferences.size() <= actualSubReference) {
        return true;
    }
    final ISubReference subreference = subreferences.get(actualSubReference);
    switch(subreference.getReferenceType()) {
        case arraySubReference:
            return false;
        case fieldSubReference:
            {
                final Identifier id = subreference.getId();
                final CompField compField = components.getCompByName(id);
                if (compField == null) {
                    return false;
                }
                final IType fieldType = compField.getType();
                if (fieldType == null) {
                    return false;
                }
                typeArray.add(this);
                return fieldType.getFieldTypesAsArray(reference, actualSubReference + 1, typeArray);
            }
        case parameterisedSubReference:
            return false;
        default:
            return false;
    }
}
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) IType(org.eclipse.titan.designer.AST.IType)

Example 38 with ISubReference

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

the class Any_Type method getFieldType.

@Override
public /**
 * {@inheritDoc}
 */
IType getFieldType(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference, final Expected_Value_type expectedIndex, final IReferenceChain refChain, final boolean interruptIfOptional) {
    final List<ISubReference> subreferences = reference.getSubreferences();
    if (subreferences.size() <= actualSubReference) {
        return this;
    }
    final ISubReference subreference = subreferences.get(actualSubReference);
    subreference.getLocation().reportSemanticError(IReferencingType.INVALIDREFERENCETYPE);
    return null;
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference)

Example 39 with ISubReference

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

the class ImportModule method addProposal.

/**
 * Adds the imported module or definitions contained in it, to the list
 * completion proposals.
 *
 * @param propCollector
 *                the proposal collector.
 * @param targetModuleId
 *                the identifier of the module where the definition will
 *                be inserted. It is used to check if it is visible
 *                there or not.
 */
@Override
public /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final Identifier targetModuleId) {
    final List<ISubReference> subrefs = propCollector.getReference().getSubreferences();
    if (propCollector.getReference().getModuleIdentifier() == null && subrefs.size() == 1) {
        propCollector.addProposal(identifier, ImageCache.getImage(getOutlineIcon()), KIND);
    }
    final Module savedReferredModule = referredModule;
    if (savedReferredModule != null) {
        final Assignments assignments = savedReferredModule.getAssignments();
        for (int i = 0, size = assignments.getNofAssignments(); i < size; i++) {
            final Assignment temporalAssignment = assignments.getAssignmentByIndex(i);
            if (savedReferredModule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, temporalAssignment)) {
                temporalAssignment.addProposal(propCollector, 0);
            }
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) Assignments(org.eclipse.titan.designer.AST.Assignments) Module(org.eclipse.titan.designer.AST.Module)

Example 40 with ISubReference

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

the class ASN1_Enumerated_Type method addProposal.

@Override
public final /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final int i) {
    final List<ISubReference> subreferences = propCollector.getReference().getSubreferences();
    if (subreferences.size() <= i || enumerations == null) {
        return;
    }
    final ISubReference subreference = subreferences.get(i);
    if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
        if (subreferences.size() <= i + 1) {
            final String referenceName = subreference.getId().getName();
            if (enumerations.enumItems1 != null) {
                final List<EnumItem> enumItems = enumerations.enumItems1.getItems();
                for (EnumItem item : enumItems) {
                    final Identifier itemID = item.getId();
                    if (itemID.getName().startsWith(referenceName)) {
                        propCollector.addProposal(itemID, " - " + "named integer", ImageCache.getImage(getOutlineIcon()), "named integer");
                    }
                }
            }
            if (enumerations.enumItems2 != null) {
                final List<EnumItem> enumItems = enumerations.enumItems2.getItems();
                for (EnumItem item : enumItems) {
                    final Identifier itemID = item.getId();
                    if (itemID.getName().startsWith(referenceName)) {
                        propCollector.addProposal(itemID, " - " + "named integer", ImageCache.getImage(getOutlineIcon()), "named integer");
                    }
                }
            }
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) Identifier(org.eclipse.titan.designer.AST.Identifier) EnumItem(org.eclipse.titan.designer.AST.TTCN3.types.EnumItem)

Aggregations

ISubReference (org.eclipse.titan.designer.AST.ISubReference)205 IType (org.eclipse.titan.designer.AST.IType)80 IValue (org.eclipse.titan.designer.AST.IValue)63 Identifier (org.eclipse.titan.designer.AST.Identifier)53 Value (org.eclipse.titan.designer.AST.Value)47 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)46 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)40 Assignment (org.eclipse.titan.designer.AST.Assignment)28 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)25 Reference (org.eclipse.titan.designer.AST.Reference)18 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)15 ArrayList (java.util.ArrayList)14 Template (org.eclipse.jface.text.templates.Template)11 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)11 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)11 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)10 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)8 Module (org.eclipse.titan.designer.AST.Module)8 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)7 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)6