Search in sources :

Example 21 with Assignment

use of org.eclipse.titan.designer.AST.Assignment in project titan.EclipsePlug-ins by eclipse.

the class FormalParameter method checkActualParameterTimer.

/**
 * Checks if the actual parameter paired with this formal parameter is
 * semantically correct as a timer parameter.
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 * @param actualParameter
 *                the template instance assigned as actual parameter to
 *                this formal parameter
 * @param expectedValue
 *                the value kind expected from the actual parameter.
 *
 * @return the actual parameter created from the value, or null if there
 *         was an error.
 */
private ActualParameter checkActualParameterTimer(final CompilationTimeStamp timestamp, final TemplateInstance actualParameter, final Expected_Value_type expectedValue) {
    final IType parameterType = actualParameter.getType();
    if (parameterType != null) {
        actualParameter.getLocation().reportSemanticError(EXPLICITESPECIFICATIONFORTIMER);
        actualParameter.checkType(timestamp, null);
    }
    final Reference derivedReference = actualParameter.getDerivedReference();
    if (derivedReference != null) {
        derivedReference.getLocation().reportSemanticError(INLINETEMPLATEFORTIMER);
        actualParameter.checkDerivedReference(timestamp, null);
    }
    final ITTCN3Template template = actualParameter.getTemplateBody();
    if (Template_type.SPECIFIC_VALUE.equals(template.getTemplatetype()) && ((SpecificValue_Template) template).isReference()) {
        final Reference reference = ((SpecificValue_Template) template).getReference();
        final Assignment assignment = reference.getRefdAssignment(timestamp, true, null);
        if (assignment == null) {
            final ActualParameter temp = new Value_ActualParameter(null);
            temp.setIsErroneous();
            return temp;
        }
        switch(assignment.getAssignmentType()) {
            case A_TIMER:
                final ArrayDimensions dimensions = ((Def_Timer) assignment).getDimensions();
                if (dimensions != null) {
                    dimensions.checkIndices(timestamp, reference, "timer", false, expectedValue);
                } else if (reference.getSubreferences().size() > 1) {
                    reference.getLocation().reportSemanticError(MessageFormat.format(SUBREFERENCEERROR1, assignment.getDescription()));
                }
                break;
            case A_PAR_TIMER:
                if (reference.getSubreferences().size() > 1) {
                    reference.getLocation().reportSemanticError(MessageFormat.format(SUBREFERENCEERROR2, assignment.getDescription()));
                }
                break;
            default:
                reference.getLocation().reportSemanticError(MessageFormat.format(TIMEREXPECTED1, assignment.getAssignmentName()));
                break;
        }
        return new Referenced_ActualParameter(reference);
    }
    actualParameter.getLocation().reportSemanticError(TIMEREXPECTED2);
    final ActualParameter temp = new Value_ActualParameter(null);
    temp.setIsErroneous();
    return temp;
}
Also used : ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) Assignment(org.eclipse.titan.designer.AST.Assignment) SpecificValue_Template(org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ArrayDimensions(org.eclipse.titan.designer.AST.TTCN3.values.ArrayDimensions) IType(org.eclipse.titan.designer.AST.IType)

Example 22 with Assignment

use of org.eclipse.titan.designer.AST.Assignment in project titan.EclipsePlug-ins by eclipse.

the class FormalParameterList method checkActivateArgument.

/**
 * Check if a list of parsed actual parameters is semantically correct
 * according to a list of formal parameters in an activate
 * statement/operation.
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 * @param actualParameters
 *                the list of actual parameters containing both the
 *                named and the unnamed part converted into an unnamed
 *                list, that is full and in correct order.
 * @param description
 *                the description of the assignment to be used for
 *                reporting errors
 *
 * @return true if a semantic error was not found, false otherwise
 */
public final boolean checkActivateArgument(final CompilationTimeStamp timestamp, final ActualParameterList actualParameters, final String description) {
    if (actualParameters == null) {
        return false;
    }
    boolean returnValue = true;
    for (int i = 0; i < actualParameters.getNofParameters(); i++) {
        final ActualParameter actualParameter = actualParameters.getParameter(i);
        if (!(actualParameter instanceof Referenced_ActualParameter)) {
            continue;
        }
        final FormalParameter formalParameter = parameters.get(i);
        switch(formalParameter.getAssignmentType()) {
            case A_PAR_VAL_OUT:
            case A_PAR_VAL_INOUT:
            case A_PAR_TEMP_OUT:
            case A_PAR_TEMP_INOUT:
            case A_PAR_TIMER:
                // parameter types
                break;
            case A_PAR_PORT:
                // ports can be defined only in component types
                continue;
            default:
                return false;
        }
        final Reference reference = ((Referenced_ActualParameter) actualParameter).getReference();
        final Assignment assignment = reference.getRefdAssignment(timestamp, true);
        if (assignment == null) {
            return false;
        }
        switch(assignment.getAssignmentType()) {
            case A_VAR:
            case A_VAR_TEMPLATE:
            case A_TIMER:
                // variables or timers
                if (assignment.isLocal()) {
                    reference.getLocation().reportSemanticError(MessageFormat.format(ILLEGALACTIVATEPARAMETER, i + 1, description, assignment.getDescription()));
                    returnValue = false;
                }
                break;
            case A_PAR_VAL:
            case A_PAR_VAL_IN:
            case A_PAR_VAL_OUT:
            case A_PAR_VAL_INOUT:
            case A_PAR_TEMP_IN:
            case A_PAR_TEMP_OUT:
            case A_PAR_TEMP_INOUT:
            case A_PAR_TIMER:
                {
                    // it is not allowed to pass references pointing
                    // to formal parameters
                    // except for activate() statements within
                    // testcases
                    final FormalParameter referencedFormalParameter = (FormalParameter) assignment;
                    final FormalParameterList formalParameterList = referencedFormalParameter.getMyParameterList();
                    if (formalParameterList != null) {
                        final Definition definition = formalParameterList.getMyDefinition();
                        if (definition != null && !Assignment_type.A_TESTCASE.semanticallyEquals(definition.getAssignmentType())) {
                            reference.getLocation().reportSemanticError(MessageFormat.format(ILLEGALACTIVATEPARAMETER, i + 1, description, assignment.getDescription()));
                            returnValue = false;
                        }
                    }
                    break;
                }
            default:
                break;
        }
    }
    return returnValue;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) Reference(org.eclipse.titan.designer.AST.Reference)

Example 23 with Assignment

use of org.eclipse.titan.designer.AST.Assignment in project titan.EclipsePlug-ins by eclipse.

the class FormalParameterList method check.

public final void check(final CompilationTimeStamp timestamp, final Assignment_type definitionType) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    minimumNofParameters = 0;
    isStartable = true;
    for (int i = 0, size = parameters.size(); i < size; i++) {
        FormalParameter parameter = parameters.get(i);
        final Identifier identifier = parameter.getIdentifier();
        if (parentScope != null) {
            if (parentScope.hasAssignmentWithId(timestamp, identifier)) {
                parameter.getLocation().reportSemanticError(MessageFormat.format(HIDINGSCOPEELEMENT, identifier.getDisplayName()));
                parentScope.hasAssignmentWithId(timestamp, identifier);
                final List<ISubReference> subReferences = new ArrayList<ISubReference>();
                subReferences.add(new FieldSubReference(identifier));
                final Reference reference = new Reference(null, subReferences);
                final Assignment assignment = parentScope.getAssBySRef(timestamp, reference);
                if (assignment != null && assignment.getLocation() != null) {
                    assignment.getLocation().reportSingularSemanticWarning(MessageFormat.format(HIDDENSCOPEELEMENT, identifier.getDisplayName()));
                }
            } else if (parentScope.isValidModuleId(identifier)) {
                parameter.getLocation().reportSemanticWarning(MessageFormat.format(HIDINGMODULEIDENTIFIER, identifier.getDisplayName()));
            }
        }
        parameter.check(timestamp);
        if (parameter.getAssignmentType() != parameter.getRealAssignmentType()) {
            parameter = parameter.setParameterType(parameter.getRealAssignmentType());
            parameters.set(i, parameter);
        }
        if (Assignment_type.A_TEMPLATE.semanticallyEquals(definitionType)) {
            if (!Assignment_type.A_PAR_VAL_IN.semanticallyEquals(parameter.getAssignmentType()) && !Assignment_type.A_PAR_TEMP_IN.semanticallyEquals(parameter.getAssignmentType())) {
                parameter.getLocation().reportSemanticError("A template cannot have " + parameter.getAssignmentName());
            }
        } else if (Assignment_type.A_TESTCASE.semanticallyEquals(definitionType)) {
            if (Assignment_type.A_PAR_TIMER.semanticallyEquals(parameter.getAssignmentType()) && Assignment_type.A_PAR_PORT.semanticallyEquals(parameter.getAssignmentType())) {
                parameter.getLocation().reportSemanticError("A testcase cannot have " + parameter.getAssignmentName());
            }
        } else {
        // everything is allowed for functions and altsteps
        }
        // startability check
        switch(parameter.getAssignmentType()) {
            case A_PAR_VAL:
            case A_PAR_VAL_IN:
            case A_PAR_VAL_OUT:
            case A_PAR_VAL_INOUT:
            case A_PAR_TEMP_IN:
            case A_PAR_TEMP_OUT:
            case A_PAR_TEMP_INOUT:
                {
                    final IType tempType = parameter.getType(timestamp);
                    if (isStartable && tempType != null && tempType.isComponentInternal(timestamp)) {
                        isStartable = false;
                    }
                    break;
                }
            default:
                isStartable = false;
        }
        if (!parameter.hasDefaultValue()) {
            minimumNofParameters = i + 1;
        }
    }
    if (parameters.size() > reportTooManyParametersSize) {
        getLocation().reportConfigurableSemanticProblem(reportTooManyParameters, MessageFormat.format(TOOMANYPARAMETERS, reportTooManyParametersSize));
    }
    checkUniqueness(timestamp);
    lastTimeChecked = timestamp;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) Identifier(org.eclipse.titan.designer.AST.Identifier) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) Reference(org.eclipse.titan.designer.AST.Reference) ArrayList(java.util.ArrayList) IType(org.eclipse.titan.designer.AST.IType)

Example 24 with Assignment

use of org.eclipse.titan.designer.AST.Assignment in project titan.EclipsePlug-ins by eclipse.

the class AltGuards method generateCodeAlt.

/**
 * Generate code for an alt
 *
 * @param aData the structure to put imports into and get temporal variable names from.
 * @param source the source code generated
 */
public void generateCodeAlt(final JavaGenData aData, final StringBuilder source) {
    aData.addBuiltinTypeImport("TitanAlt_Status");
    boolean labelNeeded = hasRepeat;
    boolean hasElseBranch = false;
    for (int i = 0; i < altGuards.size(); i++) {
        final AltGuard altGuard = altGuards.get(i);
        switch(altGuard.getType()) {
            case AG_OP:
                if (((Operation_Altguard) altGuard).getGuardStatement().canRepeat()) {
                    labelNeeded = true;
                }
                break;
            case AG_REF:
            case AG_INVOKE:
                labelNeeded = true;
                break;
            case AG_ELSE:
                hasElseBranch = true;
                break;
            default:
                ErrorReporter.INTERNAL_ERROR("unknown altguard type encountered `" + getFullName() + "''");
                return;
        }
        if (hasElseBranch) {
            break;
        }
    }
    // if there is no [else] branch the defaults may return ALT_REPEAT
    if (!hasElseBranch) {
        labelNeeded = true;
    }
    // opening bracket of the statement block
    label = aData.getTemporaryVariableName();
    if (labelNeeded) {
        source.append(label).append(":\n");
    }
    source.append("for ( ; ; ) {\n");
    // temporary variables used for caching of status codes
    for (int i = 0; i < altGuards.size(); i++) {
        final AltGuard altGuard = altGuards.get(i);
        if (altGuard.getType().equals(altguard_type.AG_ELSE)) {
            break;
        }
        source.append(MessageFormat.format("TitanAlt_Status {0}_alt_flag_{1} = ", label, i));
        if (altGuard.getGuardExpression() == null) {
            source.append("TitanAlt_Status.ALT_MAYBE");
        } else {
            source.append("TitanAlt_Status.ALT_UNCHECKED");
        }
        source.append(";\n");
    }
    if (!hasElseBranch) {
        source.append(MessageFormat.format("TitanAlt_Status {0}_default_flag = TitanAlt_Status.ALT_MAYBE;\n", label));
    }
    // the first snapshot is taken in non-blocking mode
    aData.addCommonLibraryImport("TTCN_Snapshot");
    source.append("TTCN_Snapshot.takeNew(false);\n");
    // and opening infinite for() loop
    source.append("for ( ; ; ) {\n");
    for (int i = 0; i < altGuards.size(); i++) {
        final AltGuard altGuard = altGuards.get(i);
        final altguard_type altGuardType = altGuard.getType();
        if (altGuardType.equals(altguard_type.AG_ELSE)) {
            source.append("TTCN_Snapshot.elseBranchReached();\n");
            StatementBlock block = altGuard.getStatementBlock();
            if (block.getSize() > 0) {
                source.append("{\n");
                // FIXME handle debugger
                block.generateCode(aData, source);
                source.append("}\n");
            }
            if (block.hasReturn(CompilationTimeStamp.getBaseTimestamp()) != ReturnStatus_type.RS_YES) {
                source.append("break;\n");
            }
            // do not generate code for further branches
            break;
        } else {
            final IValue guardExpression = altGuard.getGuardExpression();
            if (guardExpression != null) {
                source.append(MessageFormat.format("if ({0}_alt_flag_{1} == TitanAlt_Status.ALT_UNCHECKED) '{'\n", label, i));
                guardExpression.getLocation().update_location_object(aData, source);
                final ExpressionStruct expression = new ExpressionStruct();
                guardExpression.generateCodeExpression(aData, expression, true);
                source.append(expression.preamble);
                source.append(MessageFormat.format("if(TitanBoolean.getNative({0})) '{'\n", expression.expression));
                source.append(MessageFormat.format("{0}_alt_flag_{1} = TitanAlt_Status.ALT_MAYBE;\n", label, i));
                source.append("} else {\n");
                source.append(MessageFormat.format("{0}_alt_flag_{1} = TitanAlt_Status.ALT_NO;\n", label, i));
                source.append("}\n");
                source.append("}\n");
            }
            source.append(MessageFormat.format("if ({0}_alt_flag_{1} == TitanAlt_Status.ALT_MAYBE) '{'\n", label, i));
            boolean canRepeat = false;
            final ExpressionStruct expression = new ExpressionStruct();
            expression.expression.append(MessageFormat.format("{0}_alt_flag_{1} = ", label, i));
            switch(altGuardType) {
                case AG_OP:
                    {
                        // the guard operation is a receiving statement
                        final Statement statement = ((Operation_Altguard) altGuard).getGuardStatement();
                        altGuard.getLocation().update_location_object(aData, source);
                        statement.generateCodeExpression(aData, expression);
                        canRepeat = statement.canRepeat();
                    }
                    break;
                case AG_REF:
                    {
                        // the guard operation is an altstep instance
                        final Reference reference = ((Referenced_Altguard) altGuard).getGuardReference();
                        altGuard.getLocation().update_location_object(aData, source);
                        final Assignment altstep = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
                        expression.expression.append(MessageFormat.format("{0}_instance(", altstep.getGenNameFromScope(aData, source, myScope, "")));
                        final ISubReference subreference = reference.getSubreferences().get(0);
                        ((ParameterisedSubReference) subreference).getActualParameters().generateCodeAlias(aData, expression);
                        source.append(')');
                        canRepeat = true;
                    }
                    break;
                case AG_INVOKE:
                    {
                        // the guard operation is an altstep invocation
                        altGuard.getLocation().update_location_object(aData, source);
                        ((Invoke_Altguard) altGuard).generateCodeInvokeInstance(aData, expression);
                        canRepeat = true;
                    }
                    break;
                default:
                    ErrorReporter.INTERNAL_ERROR("unknown altguard type encountered `" + getFullName() + "''");
                    return;
            }
            expression.mergeExpression(source);
            if (canRepeat) {
                source.append(MessageFormat.format("if ({0}_alt_flag_{1} == TitanAlt_Status.ALT_REPEAT) continue {2};\n", label, i, label));
            }
            if (altGuardType.equals(altguard_type.AG_REF) || altGuardType.equals(altguard_type.AG_INVOKE)) {
                source.append(MessageFormat.format("if ({0}_alt_flag_{1} == TitanAlt_Status.ALT_BREAK) break;\n", label, i));
            }
            // execution of statement block if the guard was successful
            source.append(MessageFormat.format("if ({0}_alt_flag_{1} == TitanAlt_Status.ALT_YES) ", label, i));
            final StatementBlock block = altGuard.getStatementBlock();
            if (block != null && block.getSize() > 0) {
                source.append("{\n");
                // TODO handle debugger
                block.generateCode(aData, source);
                if (!ReturnStatus_type.RS_YES.equals(block.hasReturn(CompilationTimeStamp.getBaseTimestamp()))) {
                    source.append("break;\n");
                }
                source.append("}\n");
            } else {
                source.append("break;\n");
            }
            source.append("}\n");
        }
    }
    if (!hasElseBranch) {
        aData.addCommonLibraryImport("TTCN_Default");
        source.append(MessageFormat.format("if ({0}_default_flag == TitanAlt_Status.ALT_MAYBE) '{'\n", label));
        source.append(MessageFormat.format("{0}_default_flag = TTCN_Default.tryAltsteps();\n", label));
        source.append(MessageFormat.format("if ({0}_default_flag == TitanAlt_Status.ALT_YES || {0}_default_flag == TitanAlt_Status.ALT_BREAK) '{'\n", label));
        source.append("break;\n");
        source.append(MessageFormat.format("} else if({0}_default_flag == TitanAlt_Status.ALT_REPEAT) '{'\n", label));
        source.append(MessageFormat.format("continue {0};\n", label));
        source.append("}\n");
        source.append("}\n");
        getLocation().update_location_object(aData, source);
        // error handling and taking the next snapshot in blocking mode
        source.append("if ( ");
        for (int i = 0; i < altGuards.size(); i++) {
            source.append(MessageFormat.format("{0}_alt_flag_{1} == TitanAlt_Status.ALT_NO &&", label, i));
        }
        source.append(MessageFormat.format("{0}_default_flag == TitanAlt_Status.ALT_NO) '{'\n", label));
        source.append("throw new TtcnError(\"None of the branches can be chosen in the alt statement");
        // TODO translate_string
        if (location != null && location.getFile() != null) {
            source.append(MessageFormat.format("in file {0} at line {1}", location.getFile().getName(), location.getLine()));
        }
        source.append("\");\n");
        source.append("}\n");
        source.append("TTCN_Snapshot.takeNew(true);\n");
    }
    source.append("}\n");
    source.append("break;\n");
    source.append("}\n");
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) IValue(org.eclipse.titan.designer.AST.IValue) AltGuard.altguard_type(org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard.altguard_type) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 25 with Assignment

use of org.eclipse.titan.designer.AST.Assignment in project titan.EclipsePlug-ins by eclipse.

the class AltGuards method generateCodeAltstep.

/**
 * Generate code for an altstep
 *
 * @param aData the structure to put imports into and get temporal variable names from.
 * @param source the source code generated
 */
public void generateCodeAltstep(final JavaGenData aData, final StringBuilder source) {
    final boolean hasElse = hasElse();
    if (!hasElse) {
        source.append("TitanAlt_Status returnValue = TitanAlt_Status.ALT_NO;\n");
    }
    for (int i = 0; i < altGuards.size(); i++) {
        final AltGuard altGuard = altGuards.get(i);
        final altguard_type altGuardType = altGuard.getType();
        if (altGuardType.equals(altguard_type.AG_ELSE)) {
            source.append("TTCN_Snapshot.elseBranchReached();\n");
            final StatementBlock block = altGuard.getStatementBlock();
            if (block.getSize() > 0) {
                source.append("{\n");
                // TODO debugger
                block.generateCode(aData, source);
                source.append("}\n");
            }
            if (block.hasReturn(CompilationTimeStamp.getBaseTimestamp()) != ReturnStatus_type.RS_YES) {
                source.append("return TitanAlt_Status.ALT_YES;\n");
            }
            break;
        } else {
            final AtomicInteger blockCount = new AtomicInteger(0);
            final IValue guardExpression = altGuard.getGuardExpression();
            if (guardExpression != null) {
                guardExpression.getLocation().update_location_object(aData, source);
                guardExpression.generateCodeTmp(aData, source, "if (", blockCount);
                source.append(") {\n");
                blockCount.incrementAndGet();
            }
            boolean canRepeat = false;
            final ExpressionStruct expression = new ExpressionStruct();
            switch(altGuardType) {
                case AG_OP:
                    {
                        final Statement statement = ((Operation_Altguard) altGuard).getGuardStatement();
                        altGuard.getLocation().update_location_object(aData, source);
                        statement.generateCodeExpression(aData, expression);
                        canRepeat = statement.canRepeat();
                    }
                    break;
                case AG_REF:
                    {
                        // the guard operation is an altstep instance
                        final Reference reference = ((Referenced_Altguard) altGuard).getGuardReference();
                        altGuard.getLocation().update_location_object(aData, source);
                        final Assignment altstep = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
                        expression.expression.append(MessageFormat.format("{0}_instance(", altstep.getGenNameFromScope(aData, source, myScope, "")));
                        final ISubReference subreference = reference.getSubreferences().get(0);
                        ((ParameterisedSubReference) subreference).getActualParameters().generateCodeAlias(aData, expression);
                        source.append(')');
                        canRepeat = true;
                    }
                    break;
                case AG_INVOKE:
                    {
                        // the guard operation is an altstep invocation
                        altGuard.getLocation().update_location_object(aData, source);
                        ((Invoke_Altguard) altGuard).generateCodeInvokeInstance(aData, expression);
                        canRepeat = true;
                    }
                    break;
                default:
                    ErrorReporter.INTERNAL_ERROR("unknown altguard type encountered `" + getFullName() + "''");
                    return;
            }
            if (expression.preamble.length() > 0 || expression.postamble.length() > 0) {
                if (blockCount.get() == 0) {
                    source.append("{\n");
                    blockCount.set(blockCount.get() + 1);
                }
                final String tempId = aData.getTemporaryVariableName();
                source.append(MessageFormat.format("TitanAlt_Status {0};\n", tempId));
                source.append("{\n");
                source.append(expression.preamble);
                source.append(MessageFormat.format("{0}.assign({1});\n", tempId, expression.expression));
                source.append(expression.postamble);
                source.append("}\n");
                source.append(MessageFormat.format("switch ({0}) '{'\n", tempId));
            } else {
                source.append(MessageFormat.format("switch ({0}) '{'\n", expression.expression));
            }
            source.append("case ALT_YES:\n");
            final StatementBlock block = altGuard.getStatementBlock();
            if (block != null && block.getSize() > 0) {
                source.append("{\n");
                // TODO handle debugger
                block.generateCode(aData, source);
                source.append("}\n");
            }
            if (block == null || block.hasReturn(CompilationTimeStamp.getBaseTimestamp()) != ReturnStatus_type.RS_YES) {
                source.append("return TitanAlt_Status.ALT_YES;\n");
            }
            if (canRepeat) {
                source.append("case ALT_REPEAT:\n");
                source.append("return TitanAlt_Status.ALT_REPEAT;\n");
            }
            if (altGuardType == altguard_type.AG_REF || altGuardType == altguard_type.AG_INVOKE) {
                source.append("case ALT_BREAK:\n");
                source.append("return TitanAlt_Status.ALT_BREAK;\n");
            }
            if (!hasElse) {
                source.append("case ALT_MAYBE:\n");
                source.append("returnValue = TitanAlt_Status.ALT_MAYBE;\n");
            }
            source.append("default:\n");
            source.append("break;\n");
            source.append("}\n");
            // closing statement blocks
            for (int j = 0; j < blockCount.get(); j++) {
                source.append("}\n");
            }
        }
    }
    if (!hasElse) {
        source.append("return returnValue;\n");
    }
}
Also used : AltGuard.altguard_type(org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard.altguard_type) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) IValue(org.eclipse.titan.designer.AST.IValue) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Aggregations

Assignment (org.eclipse.titan.designer.AST.Assignment)141 Reference (org.eclipse.titan.designer.AST.Reference)48 IType (org.eclipse.titan.designer.AST.IType)41 ISubReference (org.eclipse.titan.designer.AST.ISubReference)39 IValue (org.eclipse.titan.designer.AST.IValue)31 Identifier (org.eclipse.titan.designer.AST.Identifier)25 ArrayList (java.util.ArrayList)24 Module (org.eclipse.titan.designer.AST.Module)22 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)16 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)14 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)14 ExpressionStruct (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)14 Assignments (org.eclipse.titan.designer.AST.Assignments)13 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)13 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)10 Location (org.eclipse.titan.designer.AST.Location)9 ArrayDimensions (org.eclipse.titan.designer.AST.TTCN3.values.ArrayDimensions)8 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)7 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)7 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)6