use of org.eclipse.titan.designer.AST.TTCN3.statements.Start_Component_Statement in project titan.EclipsePlug-ins by eclipse.
the class Unknown_Start_Statement method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
final Assignment assignment = reference.getRefdAssignment(timestamp, true);
if (assignment == null) {
return;
}
switch(assignment.getAssignmentType()) {
case A_PORT:
case A_PAR_PORT:
if (value != null) {
value.getLocation().reportSemanticError(NOARGUMENTEXPECTED);
}
if (realStatement == null || !Statement_type.S_START_PORT.equals(realStatement.getType())) {
realStatement = new Start_Port_Statement(reference);
realStatement.setMyScope(getMyScope());
realStatement.setFullNameParent(this);
realStatement.setLocation(location);
realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
}
realStatement.check(timestamp);
break;
case A_TIMER:
case A_PAR_TIMER:
if (realStatement == null || !Statement_type.S_START_TIMER.equals(realStatement.getType())) {
realStatement = new Start_Timer_Statement(reference, value);
realStatement.setMyScope(getMyScope());
realStatement.setFullNameParent(this);
realStatement.setLocation(location);
realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
}
realStatement.check(timestamp);
break;
case A_CONST:
case A_EXT_CONST:
case A_MODULEPAR:
case A_VAR:
case A_FUNCTION_RVAL:
case A_EXT_FUNCTION_RVAL:
case A_PAR_VAL:
case A_PAR_VAL_IN:
case A_PAR_VAL_OUT:
case A_PAR_VAL_INOUT:
if (value == null) {
location.reportSemanticError(MISSINGARGUMENT);
return;
}
if (!Value_type.REFERENCED_VALUE.equals(value.getValuetype())) {
value.getLocation().reportSemanticError(FUNCTIONARGUMENTEXPECTED);
return;
}
if (realStatement == null || !Statement_type.S_START_COMPONENT.equals(realStatement.getType())) {
realStatement = new Start_Component_Statement(new Referenced_Value(reference), ((Referenced_Value) value).getReference());
realStatement.setMyScope(getMyScope());
realStatement.setFullNameParent(this);
realStatement.setLocation(location);
realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
}
realStatement.check(timestamp);
break;
default:
reference.getLocation().reportSemanticError(MessageFormat.format(UNEXPECEDSTARTREFERENCE, assignment.getDescription()));
break;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.statements.Start_Component_Statement in project titan.EclipsePlug-ins by eclipse.
the class UnusedStartedFuncRetVal method process.
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof Start_Component_Statement) {
final CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp();
final Start_Component_Statement s = (Start_Component_Statement) node;
final Component_Type compType = Port_Utility.checkComponentReference(timestamp, s, s.getComponent(), false, false);
final Assignment assignment = s.getFunctionInstanceReference().getRefdAssignment(timestamp, false);
if (assignment == null) {
return;
}
switch(assignment.getAssignmentType()) {
case A_FUNCTION:
case A_FUNCTION_RTEMP:
case A_FUNCTION_RVAL:
break;
default:
return;
}
final Def_Function function = (Def_Function) assignment;
final IType runsOnType = function.getRunsOnType(timestamp);
if (compType == null || runsOnType == null || !function.isStartable()) {
return;
}
switch(function.getAssignmentType()) {
case A_FUNCTION_RTEMP:
break;
case A_FUNCTION_RVAL:
IType type = function.getType(timestamp);
boolean returnTypeCorrect = false;
while (!returnTypeCorrect) {
if (type.hasDoneAttribute()) {
returnTypeCorrect = true;
break;
}
if (type instanceof IReferencingType) {
final IReferenceChain refChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IType refd = ((IReferencingType) type).getTypeRefd(timestamp, refChain);
refChain.release();
if (type != refd) {
type = refd;
} else {
break;
}
} else {
break;
}
}
if (!returnTypeCorrect) {
final String msg = MessageFormat.format(PROBLEM, function.getDescription(), function.getType(timestamp).getTypename());
problems.report(s.getFunctionInstanceReference().getLocation(), msg);
}
break;
default:
break;
}
}
}
Aggregations