use of org.eclipse.titan.designer.AST.Identifier in project titan.EclipsePlug-ins by eclipse.
the class Enumerated_Value method getDeclaration.
@Override
public /**
* {@inheritDoc}
*/
Declaration getDeclaration() {
IType type = getMyGovernor();
if (type == null) {
return null;
}
type = type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
if (type instanceof ITypeWithComponents) {
final Identifier resultId = ((ITypeWithComponents) type).getComponentIdentifierByName(value);
return Declaration.createInstance(type.getDefiningAssignment(), resultId);
}
return null;
}
use of org.eclipse.titan.designer.AST.Identifier in project titan.EclipsePlug-ins by eclipse.
the class Set_Value method evaluateIspresent.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIspresent(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SET:
if (!((TTCN3_Set_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SET:
if (!((ASN1_Set_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SET.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Set_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIspresent(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.Identifier in project titan.EclipsePlug-ins by eclipse.
the class Set_Value method evaluateIsbound.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIsbound(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SET:
if (!((TTCN3_Set_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SET:
if (!((ASN1_Set_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SET.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Set_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIsbound(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.Identifier in project titan.EclipsePlug-ins by eclipse.
the class InternalMakefileGenerator method addTTCN3Module.
/**
* Adds a file to the list of TTCN-3 files.
* <p/>
* The directory of the file must always point to a working directory,
* or a central storage directory.
*
* @param file the file to be added.
* @param directory in which this file can be found (null if the working
* directory of the actual project)
*/
public void addTTCN3Module(final IFile file, final String directory) {
ProjectSourceParser parser = GlobalParser.getProjectSourceParser(file.getProject());
String moduleName = parser.containedModuleName(file);
if (moduleName == null) {
if (file.isSynchronized(IResource.DEPTH_ZERO)) {
ErrorReporter.logWarning("file " + file.getFullPath().toOSString() + " is out-of sync with the file system");
} else {
ErrorReporter.logWarning("file " + file.getFullPath().toOSString() + " even tough it has ttcn extension is added as on other file since the on-the-fly analyzer was not able to find a valid module inside");
}
addOtherFiles(file, directory);
return;
}
final Identifier identifier = new Identifier(Identifier_type.ID_NAME, moduleName);
ModuleStruct module;
final IPath fileLocation = file.getLocation();
if (fileLocation == null) {
final String originalLocation = directory + File.separatorChar + file.getName();
module = new ModuleStruct(directory, originalLocation, file.getName(), identifier.getTtcnName());
} else {
final String originalLocation = fileLocation.toOSString();
module = new ModuleStruct(directory, originalLocation, fileLocation.lastSegment(), identifier.getTtcnName());
}
module.setRegular(fileLocation != null && "ttcn".equals(file.getFileExtension()) && file.getName().equals(moduleName + ".ttcn"));
ttcn3Modules.add(module);
}
use of org.eclipse.titan.designer.AST.Identifier in project titan.EclipsePlug-ins by eclipse.
the class Definitions method getAssBySRef.
@Override
public /**
* {@inheritDoc}
*/
Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference, final IReferenceChain refChain) {
if (reference.getModuleIdentifier() != null) {
return getModuleScope().getAssBySRef(timestamp, reference);
}
final Identifier identifier = reference.getId();
if (identifier == null) {
return getModuleScope().getAssBySRef(timestamp, reference);
}
if (lastUniquenessCheckTimeStamp == null) {
createDefinitionMap(timestamp);
}
// uniqueness shall be reported only after checking all the definitions
final Definition result = definitionMap.get(identifier.getName());
if (result != null) {
return result;
}
return getParentScope().getAssBySRef(timestamp, reference);
}
Aggregations