use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList 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.FormalParameterList 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.FormalParameterList 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.FormalParameterList in project titan.EclipsePlug-ins by eclipse.
the class Unknown_Applied_Statement method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
if (dereferredValue == null) {
return;
}
dereferredValue.setLoweridToReference(timestamp);
IType type = dereferredValue.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE);
if (type != null) {
type = type.getTypeRefdLast(timestamp);
}
if (type == null) {
return;
}
final ActualParameterList tempActualParameters = new ActualParameterList();
FormalParameterList formalParameterList;
switch(type.getTypetype()) {
case TYPE_FUNCTION:
if (realStatement == null || !Statement_type.S_FUNCTION_APPLIED.equals(realStatement.getType())) {
realStatement = new Function_Applied_Statement(dereferredValue, actualParameterList, tempActualParameters);
realStatement.setFullNameParent(this);
realStatement.setLocation(location);
realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
}
realStatement.check(timestamp);
if (((Function_Type) type).getReturnType() != null) {
location.reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNUSEDFUNCTIONRETURNVALUES, GeneralConstants.WARNING, null), MessageFormat.format(UNUSEDRETURNVALUE, type.getTypename()));
}
formalParameterList = ((Function_Type) type).getFormalParameters();
formalParameterList.checkActualParameterList(timestamp, actualParameterList, tempActualParameters);
break;
case TYPE_ALTSTEP:
if (realStatement == null || !Statement_type.S_ALTSTEP_APPLIED.equals(realStatement.getType())) {
realStatement = new Altstep_Applied_Statement(dereferredValue, actualParameterList, tempActualParameters);
realStatement.setFullNameParent(this);
realStatement.setLocation(location);
realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
}
realStatement.check(timestamp);
formalParameterList = ((Altstep_Type) type).getFormalParameters();
formalParameterList.checkActualParameterList(timestamp, actualParameterList, tempActualParameters);
break;
default:
dereferredValue.getLocation().reportSemanticError(MessageFormat.format(FUNCTIONORALTSTEPVALUEXPECTED, type.getTypename()));
break;
}
if (myStatementBlock != null) {
myStatementBlock.checkRunsOnScope(timestamp, type, this, "call");
}
tempActualParameters.setFullNameParent(this);
tempActualParameters.setMyScope(myScope);
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList in project titan.EclipsePlug-ins by eclipse.
the class Invoke_Altguard method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
if (expression != null) {
final IValue last = expression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
final Type_type temporalType = last.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
if (!last.getIsErroneous(timestamp) && !Type_type.TYPE_BOOL.equals(temporalType)) {
last.getLocation().reportSemanticError(BOOLEANEXPECTED);
expression.setIsErroneous(true);
}
if (expression.getMyGovernor() == null) {
expression.setMyGovernor(new Boolean_Type());
}
}
IType type = value.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
if (type == null) {
lastTimeChecked = timestamp;
return;
}
type = type.getTypeRefdLast(timestamp);
if (type == null || type.getIsErroneous(timestamp)) {
lastTimeChecked = timestamp;
return;
}
if (!Type_type.TYPE_ALTSTEP.equals(type.getTypetype())) {
value.getLocation().reportSemanticError(MessageFormat.format("A value of type altstep was expected instead of `{0}''", type.getTypename()));
lastTimeChecked = timestamp;
return;
}
value.getMyScope().checkRunsOnScope(timestamp, type, this, "call");
final FormalParameterList formalParmaterList = ((Altstep_Type) type).getFormalParameters();
actualParameterList = new ActualParameterList();
formalParmaterList.checkActualParameterList(timestamp, parsedParameters, actualParameterList);
if (statementblock != null) {
statementblock.check(timestamp);
}
lastTimeChecked = timestamp;
}
Aggregations