Search in sources :

Example 6 with AltGuards

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

the class Call_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    ExpressionStruct expression = new ExpressionStruct();
    portReference.generateCode(aData, expression);
    expression.expression.append(".call(");
    parameter.generateCode(aData, expression, TemplateRestriction.Restriction_type.TR_NONE);
    if (toClause != null) {
        expression.expression.append(", ");
        toClause.generateCodeExpression(aData, expression, true);
    }
    expression.expression.append(')');
    expression.mergeExpression(source);
    if (altGuards != null) {
        source.append("{\n");
        if (timerValue != null) {
            timerValue.getLocation().update_location_object(aData, source);
            source.append("TitanTimer call_timer = new TitanTimer(null);\n");
            expression = new ExpressionStruct();
            expression.expression.append("call_timer.start(");
            timerValue.generateCodeExpression(aData, expression, false);
            expression.expression.append(')');
            expression.mergeExpression(source);
        }
        altGuards.generateCodeCallBody(aData, source, aData.getTemporaryVariableName(), false);
        source.append("}\n");
    }
}
Also used : ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 7 with AltGuards

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

the class Def_Altstep method setMyScope.

@Override
public /**
 * {@inheritDoc}
 */
void setMyScope(final Scope scope) {
    if (bridgeScope != null && bridgeScope.getParentScope() == scope) {
        return;
    }
    bridgeScope = new NamedBridgeScope();
    bridgeScope.setParentScope(scope);
    scope.addSubScope(getLocation(), bridgeScope);
    bridgeScope.setScopeMacroName(identifier.getDisplayName());
    super.setMyScope(bridgeScope);
    if (runsOnRef != null) {
        runsOnRef.setMyScope(bridgeScope);
    }
    formalParList.setMyScope(bridgeScope);
    if (block != null) {
        block.setMyScope(formalParList);
        altGuards.setMyScope(block);
        bridgeScope.addSubScope(block.getLocation(), block);
    }
    bridgeScope.addSubScope(formalParList.getLocation(), formalParList);
    if (altGuards != null) {
        for (int i = 0; i < altGuards.getNofAltguards(); i++) {
            final AltGuard ag = altGuards.getAltguardByIndex(i);
            final StatementBlock sb = ag.getStatementBlock();
            if (sb != null) {
                bridgeScope.addSubScope(sb.getLocation(), sb);
            }
        }
    }
}
Also used : AltGuard(org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard) NamedBridgeScope(org.eclipse.titan.designer.AST.NamedBridgeScope) StatementBlock(org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock)

Aggregations

StatementBlock (org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock)3 IType (org.eclipse.titan.designer.AST.IType)2 AltGuard (org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard)2 AltGuards (org.eclipse.titan.designer.AST.TTCN3.statements.AltGuards)2 Alt_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Alt_Statement)2 Signature_Type (org.eclipse.titan.designer.AST.TTCN3.types.Signature_Type)2 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)1 IValue (org.eclipse.titan.designer.AST.IValue)1 NamedBridgeScope (org.eclipse.titan.designer.AST.NamedBridgeScope)1 Reference (org.eclipse.titan.designer.AST.Reference)1 IIncrementallyUpdateable (org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable)1 Assignment_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Assignment_Statement)1 DoWhile_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.DoWhile_Statement)1 For_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.For_Statement)1 If_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.If_Statement)1 Interleave_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Interleave_Statement)1 Operation_Altguard (org.eclipse.titan.designer.AST.TTCN3.statements.Operation_Altguard)1 Receive_Port_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Receive_Port_Statement)1 Repeat_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Repeat_Statement)1 Return_Statement (org.eclipse.titan.designer.AST.TTCN3.statements.Return_Statement)1