use of org.eclipse.titan.designer.AST.Location in project titan.EclipsePlug-ins by eclipse.
the class Parameterised_Reference method newInstance.
public Parameterised_Reference newInstance() {
Parameterised_Reference temp = null;
temp = new Parameterised_Reference(assignmentReference.newInstance(), mBlock);
temp.setLocation(new Location(location));
return temp;
}
use of org.eclipse.titan.designer.AST.Location in project titan.EclipsePlug-ins by eclipse.
the class Object_Definition method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
if (null == fieldSettingMap) {
fieldSettingMap = new HashMap<String, FieldSetting>(fieldSettings.size());
}
fieldSettingMap.clear();
if (null != myGovernor) {
myGovernor.check(timestamp);
}
parseBlock(timestamp);
String name;
for (int i = 0; i < fieldSettings.size(); i++) {
final FieldSetting fieldSetting = fieldSettings.get(i);
name = fieldSetting.getName().getName();
if (fieldSettingMap.containsKey(name)) {
final Location location = fieldSettingMap.get(name).getLocation();
location.reportSingularSemanticError(MessageFormat.format(DUPLICATEDFIELDSETTINGFIRST, fieldSetting.getName().getDisplayName()));
fieldSetting.getLocation().reportSemanticError(MessageFormat.format(DUPLICATEDFIELDSETTINGREPEATED, fieldSetting.getName().getDisplayName()));
} else {
fieldSettingMap.put(name, fieldSetting);
}
}
fieldSettings.trimToSize();
if (null != myGovernor) {
myGovernor.checkThisObject(timestamp, this);
}
}
use of org.eclipse.titan.designer.AST.Location in project titan.EclipsePlug-ins by eclipse.
the class ASN1Assignments method checkUniqueness.
/**
* Checks the uniqueness of the definitions, and also builds a hashmap
* of them to speed up further searches.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
*/
public void checkUniqueness(final CompilationTimeStamp timestamp) {
if (null != lastUniqueNessCheckTimeStamp && !lastUniqueNessCheckTimeStamp.isLess(timestamp)) {
return;
}
if (null == assignmentMap) {
assignmentMap = new HashMap<String, ASN1Assignment>(assignments.size());
}
lastUniqueNessCheckTimeStamp = timestamp;
dynamic_assignments.clear();
assignmentMap.clear();
final Assignments specialAssignments = SpecialASN1Module.getSpecialModule().getAssignments();
for (ASN1Assignment assignment : assignments) {
final Identifier identifier = assignment.getIdentifier();
final String assignmentName = identifier.getName();
if (specialAssignments.hasAssignmentWithId(timestamp, identifier)) {
final Location selfLocation = assignment.getIdentifier().getLocation();
selfLocation.reportSemanticError(MessageFormat.format(RESERVEDIDENTIFIER, identifier.getDisplayName()));
} else if (assignmentMap.containsKey(assignmentName)) {
final Location otherLocation = assignmentMap.get(assignmentName).getIdentifier().getLocation();
otherLocation.reportSingularSemanticError(MessageFormat.format(DUPLICATEDEFINITIONFIRST, identifier.getDisplayName()));
final Location selfLocation = assignment.getIdentifier().getLocation();
selfLocation.reportSemanticError(MessageFormat.format(DUPLICATEDEFINITIONREPEATED, identifier.getDisplayName()));
} else {
assignmentMap.put(assignmentName, assignment);
}
}
}
use of org.eclipse.titan.designer.AST.Location in project titan.EclipsePlug-ins by eclipse.
the class ASN1Assignments method addDynamicAssignment.
/**
* Adds a dynamic assignment to the list of assignments.
* <p>
* Only assignments which were created dynamically during the semantic
* check shall be added with this function. The scope of the newly added
* assignment is set to this scope scope here.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param assignment
* the assignment to be added
*/
public void addDynamicAssignment(final CompilationTimeStamp timestamp, final ASN1Assignment assignment) {
if (null == assignment || null == assignment.getIdentifier()) {
return;
}
if (null == lastUniqueNessCheckTimeStamp) {
checkUniqueness(timestamp);
}
dynamic_assignments.add(assignment);
assignment.setMyScope(this);
final Identifier identifier = assignment.getIdentifier();
final String assignmentName = identifier.getName();
final Assignments specialAssignments = SpecialASN1Module.getSpecialModule().getAssignments();
if (specialAssignments.hasAssignmentWithId(timestamp, identifier)) {
final Location tempLocation = assignment.getIdentifier().getLocation();
tempLocation.reportSemanticError(MessageFormat.format(RESERVEDIDENTIFIER, identifier.getDisplayName()));
} else if (assignmentMap.containsKey(assignmentName)) {
final Location otherLocation = assignmentMap.get(assignmentName).getIdentifier().getLocation();
otherLocation.reportSingularSemanticError(MessageFormat.format(DUPLICATEDEFINITIONFIRST, identifier.getDisplayName()));
final Location selfLocation = assignment.getIdentifier().getLocation();
selfLocation.reportSemanticError(MessageFormat.format(DUPLICATEDEFINITIONREPEATED, identifier.getDisplayName()));
} else {
assignmentMap.put(assignmentName, assignment);
}
}
use of org.eclipse.titan.designer.AST.Location in project titan.EclipsePlug-ins by eclipse.
the class For_Statement method setMyScope.
@Override
public /**
* {@inheritDoc}
*/
void setMyScope(final Scope scope) {
super.setMyScope(scope);
if (definitions == null) {
if (initialAssignment != null) {
initialAssignment.setMyScope(scope);
}
if (finalExpression != null) {
finalExpression.setMyScope(scope);
}
if (stepAssignment != null) {
stepAssignment.setMyScope(scope);
}
if (statementblock != null) {
statementblock.setMyScope(scope);
scope.addSubScope(statementblock.getLocation(), statementblock);
}
} else {
definitions.setParentScope(scope);
final Location startLoc = definitions.getLocation();
Location endLoc = null;
if (finalExpression != null) {
finalExpression.setMyScope(definitions);
endLoc = finalExpression.getLocation();
}
if (stepAssignment != null) {
stepAssignment.setMyScope(definitions);
endLoc = stepAssignment.getLocation();
}
scope.addSubScope((endLoc == null) ? startLoc : Location.interval(startLoc, endLoc), definitions);
if (statementblock != null) {
statementblock.setMyScope(definitions);
scope.addSubScope(statementblock.getLocation(), statementblock);
}
}
}
Aggregations