Commit 78f3b883 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ added basic support for conditionals (no else if support yet)



Change-Id: I89b79bd7cb503736eddffffe1b4fdb8409c059d3
Signed-off-by: Philip Makedonski's avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent b5d3b5b4
......@@ -1654,8 +1654,61 @@ operation TDL!UnboundedLoopBehaviour execute() {
}
}
operation TDL!ConditionalBehaviour execute() {
var guards = self.block.get(0).`guard`;
for (le in guards) {
currentScope = le.scope;
var sc = self.getMainContext(le.scope);
var sb = stack.get(sc).last();
var tsl = new TTCN!FunctionStatementList();
sb.stat.add(tsl);
var sfs = new TTCN!FunctionStatement();
sfs.basic = new TTCN!BasicStatements();
sfs.basic.conditional = new TTCN!ConditionalConstruct();
//condition
sfs.basic.conditional.expression = le.expression.getDataUseValue();
tsl.statements.add(sfs);
//main block
var block = new TTCN!StatementBlock();
sfs.basic.conditional.statement = block;
var cf = self.getMainContext(le.scope);
stack.get(cf).add(block);
for (b in self.block.get(0).behaviour) {
b.execute();
}
stack.get(cf).remove(block);
//TODO: else ifs
//else block
if (self.block.size() > 1) {
sfs.basic.conditional.`else` = new TTCN!ElseClause();
var eBlock = new TTCN!StatementBlock();
sfs.basic.conditional.`else`.statement = eBlock;
stack.get(cf).add(eBlock);
for (b in self.block.last().behaviour) {
b.execute();
}
stack.get(cf).remove(eBlock);
}
currentScope = null;
}
}
operation TDL!tdl::Assignment execute() {
//TODO
var ci = self.variable.componentInstance;
if (simulateSUT or ci.role = TDL!ComponentInstanceRole#Tester) {
var sc = self.getMainContext(ci);
......@@ -1679,7 +1732,6 @@ operation TDL!tdl::Assignment execute() {
sb.stat.add(ssl);
}
}
operation TDL!Assertion execute() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment