use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class ObjectSet_definition 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) {
return;
}
final ISubReference subreference = subreferences.get(i);
if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
if (subreferences.size() > i + 1) {
// the reference might go on
Object_Definition def;
for (int j = 0; j < objects.getNofObjects(); j++) {
def = objects.getObjectByIndex(j);
def.addProposal(propCollector, i + 1);
}
} else {
// final part of the reference
Object_Definition def;
for (int j = 0; j < objects.getNofObjects(); j++) {
def = objects.getObjectByIndex(j);
def.addProposal(propCollector, i);
}
}
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class Object_Definition method addProposal.
@Override
public /**
* {@inheritDoc}
*/
void addProposal(final ProposalCollector propCollector, final int i) {
final List<ISubReference> subreferences = propCollector.getReference().getSubreferences();
if (subreferences.size() <= i) {
return;
}
final ISubReference subreference = subreferences.get(i);
final String subreferenceName = subreference.getId().getName();
if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
if (subreferences.size() > i + 1) {
// the reference might go on
final FieldSetting fieldSetting = fieldSettingMap.get(subreferenceName);
if (null == fieldSetting) {
return;
}
fieldSetting.addProposal(propCollector, i + 1);
} else {
// final part of the reference
for (int j = 0; j < fieldSettings.size(); j++) {
final FieldSetting fieldSetting = fieldSettings.get(i);
if (fieldSetting.getName().getName().startsWith(subreferenceName)) {
propCollector.addProposal(fieldSetting.getName(), "- Object field", null, "FieldSetting");
}
}
}
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class Object_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);
final String subreferenceName = subreference.getId().getName();
if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
if (subreferences.size() > i + 1) {
// the reference might go on
final FieldSetting fieldSetting = fieldSettingMap.get(subreferenceName);
if (null == fieldSetting) {
return;
}
fieldSetting.addDeclaration(declarationCollector, i + 1);
} else {
// final part of the reference
String name;
for (int j = 0; j < fieldSettings.size(); j++) {
final FieldSetting fieldSetting = fieldSettings.get(i);
name = fieldSetting.getName().getName();
if (name.startsWith(subreferenceName)) {
declarationCollector.addDeclaration(name, fieldSetting.getLocation(), this);
}
}
}
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class Erroneous_FieldSpecification method addProposal.
@Override
public /**
* {@inheritDoc}
*/
void addProposal(final ProposalCollector propCollector, final int i) {
final List<ISubReference> subreferences = propCollector.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) {
propCollector.addProposal(identifier, " - unknown fieldspeciication", null, "unknown fieldspeciication");
}
}
}
use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.
the class Parameterised_Reference method getRefDefdSimple.
/**
* Resolve the formal parameters of the referenced assignment with the
* help of the actual parameters. Instantiate a new assignment from it
* and return a reference to this assignment.
*
* @return the reference to the newly instantiated assignment.
*/
public Defined_Reference getRefDefdSimple() {
final Module module = myScope.getModuleScope();
// This is a little trick, but otherwise we would not have the
// true compilation timestamp
final CompilationTimeStamp compilationTimeStamp = module.getLastImportationCheckTimeStamp();
if (compilationTimeStamp == null) {
// compilationTimeStamp = CompilationTimeStamp.getNewCompilationCounter(); //this forces re-check
return null;
}
if (null != lastCheckTimeStamp && !lastCheckTimeStamp.isLess(compilationTimeStamp)) {
if (isErroneous) {
return null;
}
return finalReference;
}
lastCheckTimeStamp = compilationTimeStamp;
final Assignment parass = assignmentReference.getRefdAssignment(compilationTimeStamp, true, null);
if (null == parass) {
isErroneous = true;
return null;
} else if (!(parass instanceof ASN1Assignment)) {
assignmentReference.getLocation().reportSemanticError(ASSIGNMENTEXPECTED);
isErroneous = true;
return null;
}
final Ass_pard assPard = ((ASN1Assignment) parass).getAssPard();
if (null == assPard) {
assignmentReference.getLocation().reportSemanticError(PARAMETERISEDASSIGNMENTEXPECTED);
isErroneous = true;
return assignmentReference;
}
addAssignments(assPard, compilationTimeStamp);
// Add the assignments made from the formal and actual
// parameters to the actual module
assignments.setRightScope(myScope);
assignments.setParentScope(parass.getMyScope());
assignments.setFullNameParent(this);
assignments.check(compilationTimeStamp);
// create a copy of the assignment and add it to the actual
// module
final ASN1Assignment newAssignment = ((ASN1Assignment) parass).newInstance(module);
newAssignmentNameStart = new NameReStarter(new StringBuilder(module.getFullName()).append(INamedNode.DOT).append(newAssignment.getIdentifier().getDisplayName()).toString());
newAssignmentNameStart.setFullNameParent(parass);
newAssignment.setFullNameParent(newAssignmentNameStart);
newAssignment.setLocation(location);
newAssignment.getIdentifier().setLocation(assignmentReference.getLocation());
((ASN1Assignments) module.getAssignments()).addDynamicAssignment(compilationTimeStamp, newAssignment);
newAssignment.setMyScope(assignments);
newAssignment.check(compilationTimeStamp);
final List<ISubReference> subreferences = new ArrayList<ISubReference>(1);
subreferences.add(new FieldSubReference(newAssignment.getIdentifier()));
finalReference = new Defined_Reference(module.getIdentifier(), subreferences);
finalReference.setFullNameParent(this);
finalReference.setMyScope(module);
return finalReference;
}
Aggregations