use of org.eclipse.titan.designer.AST.TTCN3.definitions.Template_ActualParameter in project titan.EclipsePlug-ins by eclipse.
the class All_From_Template method checkThisTemplateParameterizedReference.
private boolean checkThisTemplateParameterizedReference(final Reference reference, final Assignment lhs) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (subreferences.isEmpty() || !(subreferences.get(0) instanceof ParameterisedSubReference)) {
return false;
}
final ParameterisedSubReference subReference = (ParameterisedSubReference) subreferences.get(0);
final ActualParameterList actualParameterList = subReference.getActualParameters();
if (actualParameterList == null) {
return false;
}
final int nofParameters = actualParameterList.getNofParameters();
for (int i = 0; i < nofParameters; i++) {
Reference parameterReference = null;
final ActualParameter actualParameter = actualParameterList.getParameter(i);
if (actualParameter instanceof Template_ActualParameter) {
TemplateInstance templateInstance = ((Template_ActualParameter) actualParameter).getTemplateInstance();
ITTCN3Template template = templateInstance.getTemplateBody();
template = template.setLoweridToReference(CompilationTimeStamp.getBaseTimestamp());
if (template.getTemplatetype() == Template_type.TEMPLATE_REFD) {
parameterReference = ((Referenced_Template) template).getReference();
}
} else if (actualParameter instanceof Referenced_ActualParameter) {
parameterReference = ((Referenced_ActualParameter) actualParameter).getReference();
}
if (parameterReference != null) {
final Assignment assignment = parameterReference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
if (assignment == lhs) {
return true;
}
// check their parameters as well
switch(assignment.getAssignmentType()) {
case A_TEMPLATE:
case A_FUNCTION_RVAL:
case A_FUNCTION_RTEMP:
case A_EXT_FUNCTION_RVAL:
case A_EXT_FUNCTION_RTEMP:
if (checkThisTemplateParameterizedReference(parameterReference, lhs)) {
return true;
}
break;
default:
break;
}
}
}
return false;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Template_ActualParameter in project titan.EclipsePlug-ins by eclipse.
the class FormalParameter method checkActualParameterTemplate.
private ActualParameter checkActualParameterTemplate(final CompilationTimeStamp timestamp, final TemplateInstance actualParameter) {
actualParameter.check(timestamp, type);
final TemplateInstance instance = new TemplateInstance(actualParameter.getType(), actualParameter.getDerivedReference(), actualParameter.getTemplateBody());
final ActualParameter returnValue = new Template_ActualParameter(instance);
if (!Restriction_type.TR_NONE.equals(templateRestriction)) {
instance.checkRestriction(timestamp, this);
}
return returnValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Template_ActualParameter in project titan.EclipsePlug-ins by eclipse.
the class FormalParameterList method setGenName.
public void setGenName(final String prefix) {
for (final FormalParameter parameter : parameters) {
final String parameterName = parameter.getIdentifier().getName();
if (!Assignment_type.A_TIMER.equals(parameter.getAssignmentType())) {
final Type parameterType = parameter.getType(CompilationTimeStamp.getBaseTimestamp());
if (parameterType != null) {
parameterType.setGenName(prefix, parameterName);
}
}
if (parameter.hasDefaultValue()) {
final StringBuilder embeddedName = new StringBuilder(prefix);
embeddedName.append('_');
embeddedName.append(parameterName);
embeddedName.append("_defval");
final ActualParameter defaultValue = parameter.getDefaultValue();
if (defaultValue instanceof Value_ActualParameter) {
final IValue value = ((Value_ActualParameter) defaultValue).getValue();
// value.setGenNamePrefix("const_");//currently does not need the prefix
value.setGenNameRecursive(embeddedName.toString());
} else if (defaultValue instanceof Template_ActualParameter) {
final TemplateInstance instance = ((Template_ActualParameter) defaultValue).getTemplateInstance();
final TTCN3Template template = instance.getTemplateBody();
// template.setGenNamePrefix("template_");//currently does not need the prefix
template.setGenNameRecursive(embeddedName.toString());
}
}
}
}
Aggregations