Search in sources :

Example 1 with Call_Statement

use of org.eclipse.titan.designer.AST.TTCN3.statements.Call_Statement in project titan.EclipsePlug-ins by eclipse.

the class Shorthand method check.

protected void check(final Statement s, final Problems problems) {
    if (s == null) {
        return;
    }
    // shorthand statements are ignored inside alt statements
    INamedNode curr = s;
    while (curr != null) {
        if (curr instanceof Alt_Statement || curr instanceof Call_Statement) {
            return;
        }
        curr = curr.getNameParent();
    }
    final StatementBlock sb = s.getMyStatementBlock();
    if (sb == null) {
        return;
    }
    final Definition d = sb.getMyDefinition();
    if (d == null) {
        return;
    }
    // shorthand statements are marked in functions, test cases and altsteps that have a 'runs on' clause
    if (d instanceof Def_Function && ((Def_Function) d).getRunsOnType(timestamp) != null) {
        problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX);
        return;
    }
    if (d instanceof Def_Altstep || d instanceof Def_Testcase) {
        problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX);
    }
}
Also used : Def_Testcase(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase) INamedNode(org.eclipse.titan.designer.AST.INamedNode) Call_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Call_Statement) Alt_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Alt_Statement) Definition(org.eclipse.titan.designer.AST.TTCN3.definitions.Definition) Def_Altstep(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep) StatementBlock(org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock) Def_Function(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)

Aggregations

INamedNode (org.eclipse.titan.designer.AST.INamedNode)1 Def_Altstep (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep)1 Def_Function (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)1 Def_Testcase (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase)1 Definition (org.eclipse.titan.designer.AST.TTCN3.definitions.Definition)1 Alt_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Alt_Statement)1 Call_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Call_Statement)1 StatementBlock (org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock)1