Package: TraceCoreDeclVisitorIR

TraceCoreDeclVisitorIR

nameinstructionbranchcomplexitylinemethod
TraceCoreDeclVisitorIR()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
caseAApplyExpressionTraceCoreDefinition(AApplyExpressionTraceCoreDefinition, IRInfo)
M: 0 C: 19
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
caseABracketedExpressionTraceCoreDefinition(ABracketedExpressionTraceCoreDefinition, IRInfo)
M: 11 C: 35
76%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 7
88%
M: 0 C: 1
100%
caseAConcurrentExpressionTraceCoreDefinition(AConcurrentExpressionTraceCoreDefinition, IRInfo)
M: 0 C: 30
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: package org.overture.codegen.traces;
2:
3: import org.apache.log4j.Logger;
4: import org.overture.ast.analysis.AnalysisException;
5: import org.overture.ast.definitions.traces.AApplyExpressionTraceCoreDefinition;
6: import org.overture.ast.definitions.traces.ABracketedExpressionTraceCoreDefinition;
7: import org.overture.ast.definitions.traces.AConcurrentExpressionTraceCoreDefinition;
8: import org.overture.ast.definitions.traces.ATraceDefinitionTerm;
9: import org.overture.ast.definitions.traces.PTraceDefinition;
10: import org.overture.ast.statements.PStm;
11: import org.overture.codegen.ir.IRInfo;
12: import org.overture.codegen.ir.SStmIR;
13: import org.overture.codegen.ir.STermIR;
14: import org.overture.codegen.ir.STraceCoreDeclIR;
15: import org.overture.codegen.ir.STraceDeclIR;
16: import org.overture.codegen.ir.traces.AApplyExpTraceCoreDeclIR;
17: import org.overture.codegen.ir.traces.ABracketedExpTraceCoreDeclIR;
18: import org.overture.codegen.ir.traces.AConcurrentExpTraceCoreDeclIR;
19: import org.overture.codegen.ir.traces.ATraceDeclTermIR;
20: import org.overture.codegen.visitor.AbstractVisitorIR;
21:
22: public class TraceCoreDeclVisitorIR
23:                 extends AbstractVisitorIR<IRInfo, STraceCoreDeclIR>
24: {
25:         private Logger log = Logger.getLogger(this.getClass().getName());
26:
27:         @Override
28:         public STraceCoreDeclIR caseAApplyExpressionTraceCoreDefinition(
29:                         AApplyExpressionTraceCoreDefinition node, IRInfo question)
30:                         throws AnalysisException
31:         {
32:                 PStm callStm = node.getCallStatement();
33:                 SStmIR callStmCg = callStm.apply(question.getStmVisitor(), question);
34:
35:                 AApplyExpTraceCoreDeclIR applyTraceCoreDecl = new AApplyExpTraceCoreDeclIR();
36:                 applyTraceCoreDecl.setCallStm(callStmCg);
37:
38:                 return applyTraceCoreDecl;
39:         }
40:
41:         @Override
42:         public STraceCoreDeclIR caseABracketedExpressionTraceCoreDefinition(
43:                         ABracketedExpressionTraceCoreDefinition node, IRInfo question)
44:                         throws AnalysisException
45:         {
46:                 ABracketedExpTraceCoreDeclIR bracketTraceCoreDecl = new ABracketedExpTraceCoreDeclIR();
47:
48:•                for (ATraceDefinitionTerm term : node.getTerms())
49:                 {
50:                         STermIR termCg = term.apply(question.getTermVisitor(), question);
51:
52:•                        if (termCg instanceof ATraceDeclTermIR)
53:                         {
54:                                 bracketTraceCoreDecl.getTerms().add((ATraceDeclTermIR) termCg);
55:                         } else
56:                         {
57:                                 log.error("Expected term to be of type ATraceDeclTermIR. Got: "
58:                                                 + termCg);
59:                         }
60:                 }
61:
62:                 return bracketTraceCoreDecl;
63:         }
64:
65:         @Override
66:         public STraceCoreDeclIR caseAConcurrentExpressionTraceCoreDefinition(
67:                         AConcurrentExpressionTraceCoreDefinition node, IRInfo question)
68:                         throws AnalysisException
69:         {
70:                 AConcurrentExpTraceCoreDeclIR concTraceCoreDecl = new AConcurrentExpTraceCoreDeclIR();
71:
72:•                for (PTraceDefinition def : node.getDefs())
73:                 {
74:                         STraceDeclIR traceDefCg = def.apply(question.getTraceDeclVisitor(), question);
75:                         concTraceCoreDecl.getDecls().add(traceDefCg);
76:                 }
77:
78:                 return concTraceCoreDecl;
79:         }
80: }