Search in sources :

Example 1 with Unknown_Instance_Statement

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

the class UnusedRetval method process.

@Override
public void process(final IVisitableNode node, final Problems problems) {
    if (node instanceof Unknown_Instance_Statement) {
        final Unknown_Instance_Statement u = (Unknown_Instance_Statement) node;
        final Statement s = u.getRealStatement();
        if (s instanceof Function_Instance_Statement) {
            final Function_Instance_Statement f = (Function_Instance_Statement) s;
            final Assignment assignment = f.getReference().getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
            if (assignment != null) {
                String msg;
                switch(assignment.getAssignmentType()) {
                    case A_FUNCTION_RVAL:
                    case A_EXT_FUNCTION_RVAL:
                        msg = MessageFormat.format(UNUSEDRETURN1, assignment.getIdentifier().getDisplayName());
                        problems.report(f.getLocation(), msg);
                        break;
                    case A_FUNCTION_RTEMP:
                    case A_EXT_FUNCTION_RTEMP:
                        msg = MessageFormat.format(UNUSEDRETURN2, assignment.getIdentifier().getDisplayName());
                        problems.report(f.getLocation(), msg);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Statement) Unknown_Instance_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Unknown_Instance_Statement) Function_Instance_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Function_Instance_Statement) Function_Instance_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Function_Instance_Statement) Unknown_Instance_Statement(org.eclipse.titan.designer.AST.TTCN3.statements.Unknown_Instance_Statement)

Aggregations

Assignment (org.eclipse.titan.designer.AST.Assignment)1 Function_Instance_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Function_Instance_Statement)1 Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Statement)1 Unknown_Instance_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Unknown_Instance_Statement)1