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");
}
}
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);
}
}
}
}
Aggregations