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);
}
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;
}
}
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;
}
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);
}
}
}
}
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");
}
}
}
}
}
}
Aggregations