use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Enumerated_Type method getFieldType.
@Override
public final /**
* {@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);
switch(subreference.getReferenceType()) {
case arraySubReference:
subreference.getLocation().reportSemanticError(MessageFormat.format(ArraySubReference.INVALIDSUBREFERENCE, getTypename()));
return null;
case fieldSubReference:
subreference.getLocation().reportSemanticError(MessageFormat.format(FieldSubReference.INVALIDSUBREFERENCE, ((FieldSubReference) subreference).getId().getDisplayName(), getTypename()));
return null;
case parameterisedSubReference:
subreference.getLocation().reportSemanticError(MessageFormat.format(FieldSubReference.INVALIDSUBREFERENCE, ((ParameterisedSubReference) subreference).getId().getDisplayName(), getTypename()));
return null;
default:
subreference.getLocation().reportSemanticError(ISubReference.INVALIDSUBREFERENCE);
return null;
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Enumerated_Type method addDeclaration.
@Override
public final /**
* {@inheritDoc}
*/
void addDeclaration(final DeclarationCollector declarationCollector, final int i) {
final List<ISubReference> subreferences = declarationCollector.getReference().getSubreferences();
if (subreferences.size() <= i) {
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)) {
declarationCollector.addDeclaration(itemID.getDisplayName(), itemID.getLocation(), this);
}
}
}
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)) {
declarationCollector.addDeclaration(itemID.getDisplayName(), itemID.getLocation(), this);
}
}
}
}
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class ASN1Module method addDeclaration.
@Override
public /**
* {@inheritDoc}
*/
void addDeclaration(final DeclarationCollector declarationCollector) {
final Identifier moduleId = declarationCollector.getReference().getModuleIdentifier();
if (null == moduleId) {
final List<ISubReference> subrefs = declarationCollector.getReference().getSubreferences();
if (1 == subrefs.size() && null != identifier && identifier.getName().equals(subrefs.get(0).getId().getName())) {
declarationCollector.addDeclaration(name, identifier.getLocation(), this);
}
imports.addDeclaration(declarationCollector);
} else if (null != identifier && moduleId.getName().equals(identifier.getName())) {
for (int i = 0; i < assignments.getNofAssignments(); i++) {
assignments.getAssignmentByIndex(i).addDeclaration(declarationCollector, 0);
}
} else {
if (imports.hasImportedModuleWithId(moduleId)) {
final ImportModule importation = imports.getImportedModuleById(moduleId);
if (null != importation) {
importation.addDeclaration(declarationCollector, identifier);
}
}
}
super.addDeclaration(declarationCollector);
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class Exports method check.
/**
* Checks this export list.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
*/
public void check(final CompilationTimeStamp timestamp) {
if (null != lastCompilationTimeStamp && !lastCompilationTimeStamp.isLess(timestamp)) {
return;
}
if (exportAll) {
lastCompilationTimeStamp = timestamp;
return;
}
symbols.checkUniqueness(timestamp);
for (int i = 0; i < symbols.size(); i++) {
final List<ISubReference> list = new ArrayList<ISubReference>();
list.add(new FieldSubReference(symbols.getNthElement(i)));
final Defined_Reference reference = new Defined_Reference(null, list);
/* check whether exists or not */
module.getAssBySRef(timestamp, reference);
}
lastCompilationTimeStamp = timestamp;
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class ObjectClass_Definition method addDeclaration.
@Override
public /**
* {@inheritDoc}
*/
void addDeclaration(final DeclarationCollector declarationCollector, final int i) {
final List<ISubReference> subreferences = declarationCollector.getReference().getSubreferences();
if (subreferences.size() <= i) {
return;
}
final ISubReference subreference = subreferences.get(i);
if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
if (subreferences.size() > i + 1) {
// the reference might go on
final Identifier identifier = subreference.getId();
final FieldSpecification fieldSpecification = fieldSpecifications.getFieldSpecificationByIdentifier(identifier);
if (null == fieldSpecification) {
return;
}
fieldSpecification.addDeclaration(declarationCollector, i + 1);
} else {
// final part of the reference
final String name = subreference.getId().getName();
final List<FieldSpecification> fieldSpecs = fieldSpecifications.getFieldSpecificationsWithPrefix(name);
for (final FieldSpecification field : fieldSpecs) {
declarationCollector.addDeclaration(field.getIdentifier().getDisplayName(), field.getLocation(), this);
}
}
}
}
Aggregations