Package: NonDetStmTrans

NonDetStmTrans

nameinstructionbranchcomplexitylinemethod
NonDetStmTrans(TransAssistantIR)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR)
M: 11 C: 39
78%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 9
90%
M: 0 C: 1
100%

Coverage

1: package org.overture.codegen.trans.uniontypes;
2:
3: import org.overture.ast.statements.PStm;
4: import org.overture.codegen.ir.SStmIR;
5: import org.overture.codegen.ir.analysis.AnalysisException;
6: import org.overture.codegen.ir.analysis.DepthFirstAnalysisAdaptor;
7: import org.overture.codegen.ir.statements.ABlockStmIR;
8: import org.overture.codegen.ir.statements.ANonDeterministicBlockStmIR;
9: import org.overture.codegen.trans.assistants.TransAssistantIR;
10: import org.apache.log4j.Logger;
11:
12: public class NonDetStmTrans extends DepthFirstAnalysisAdaptor {
13:
14: protected Logger log = Logger.getLogger(this.getClass().getName());
15:
16: private final TransAssistantIR assist;
17:
18: public NonDetStmTrans(TransAssistantIR assist)
19: {
20: this.assist = assist;
21: }
22:
23: @Override
24: public void caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR node) throws AnalysisException {
25: super.caseANonDeterministicBlockStmIR(node);
26:
27: ABlockStmIR block = new ABlockStmIR();
28: block.setScoped(false);
29: block.setTag(node.getTag());
30: block.setSourceNode(node.getSourceNode());
31:
32:• if(!node.getStatements().isEmpty())
33: {
34: // Just use the first statement
35: block.getStatements().add(node.getStatements().getFirst().clone());
36: }
37: else
38: {
39: log.error("nondeterministic statement block did not contain any statements: " + node);
40: }
41:
42: assist.replaceNodeWith(node, block);
43: }
44: }