use of org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList in project titan.EclipsePlug-ins by eclipse.
the class Reference method checkActivateArgument.
/**
* Checks whether this is a correct altstep activation reference.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
*
* @return true if the altstep reference is correct, false otherwise.
*/
public final boolean checkActivateArgument(final CompilationTimeStamp timestamp) {
final Assignment assignment = getRefdAssignment(timestamp, true);
if (assignment == null) {
return false;
}
if (!Assignment_type.A_ALTSTEP.semanticallyEquals(assignment.getAssignmentType())) {
getLocation().reportSemanticError(MessageFormat.format(ALTSTEPEXPECTED, assignment.getDescription()));
setIsErroneous(true);
return false;
}
if (myScope != null) {
myScope.checkRunsOnScope(timestamp, assignment, this, "activate");
}
if (!subReferences.isEmpty()) {
if (Subreference_type.parameterisedSubReference.equals(subReferences.get(0).getReferenceType())) {
final ActualParameterList actualParameters = ((ParameterisedSubReference) subReferences.get(0)).getActualParameters();
final FormalParameterList formalParameterList = ((Def_Altstep) assignment).getFormalParameterList();
if (formalParameterList != null) {
return formalParameterList.checkActivateArgument(timestamp, actualParameters, assignment.getDescription());
}
}
}
return false;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList in project titan.EclipsePlug-ins by eclipse.
the class ParameterisedSubReference method checkParameters.
public boolean checkParameters(final CompilationTimeStamp timestamp, final FormalParameterList formalParameterList) {
actualParameters = new ActualParameterList();
final boolean isErroneous = formalParameterList.checkActualParameterList(timestamp, parsedParameters, actualParameters);
actualParameters.setFullNameParent(this);
actualParameters.setMyScope(myScope);
return isErroneous;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList in project titan.EclipsePlug-ins by eclipse.
the class ActivateDereferedExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
value.setLoweridToReference(timestamp);
IType type = value.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
if (type != null) {
type = type.getTypeRefdLast(timestamp);
}
if (type == null || type.getIsErroneous(timestamp)) {
setIsErroneous(true);
return;
}
if (!Type_type.TYPE_ALTSTEP.equals(type.getTypetype())) {
value.getLocation().reportSemanticError(MessageFormat.format(ALTSTEPEXPECTED, type.getTypename()));
setIsErroneous(true);
return;
}
actualParameters = new ActualParameterList();
final FormalParameterList formalParameterList = ((Altstep_Type) type).getFormalParameters();
if (formalParameterList.checkActualParameterList(timestamp, actualParameterList, actualParameters)) {
setIsErroneous(true);
return;
}
actualParameters.setFullNameParent(this);
actualParameters.setMyScope(getMyScope());
if (!formalParameterList.checkActivateArgument(timestamp, actualParameters, createStringRepresentation())) {
setIsErroneous(true);
}
checkExpressionDynamicPart(expectedValue, OPERATIONNAME, true, true, false);
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList in project titan.EclipsePlug-ins by eclipse.
the class ApplyExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
IType type = null;
if (value != null) {
value.setLoweridToReference(timestamp);
type = value.getExpressionGovernor(timestamp, expectedValue);
}
if (type == null || type.getIsErroneous(timestamp)) {
setIsErroneous(true);
return;
}
type = type.getTypeRefdLast(timestamp);
if (!Type_type.TYPE_FUNCTION.equals(type.getTypetype())) {
value.getLocation().reportSemanticError(MessageFormat.format(VALUEXPECTED3, type.getTypename()));
setIsErroneous(true);
return;
}
if (myScope != null) {
myScope.checkRunsOnScope(timestamp, type, this, "call");
}
actualParameters = new ActualParameterList();
final FormalParameterList formalParameterList = ((Function_Type) type).getFormalParameters();
if (!formalParameterList.checkActualParameterList(timestamp, actualParameterList, actualParameters)) {
actualParameters.setFullNameParent(this);
actualParameters.setMyScope(getMyScope());
}
switch(expectedValue) {
case EXPECTED_CONSTANT:
getLocation().reportSemanticError(EVALUATABLEEXPECTED);
setIsErroneous(true);
break;
case EXPECTED_STATIC_VALUE:
getLocation().reportSemanticError(STATICEXPECTED);
setIsErroneous(true);
break;
default:
break;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList 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;
}
Aggregations