Package: ValueDefinitionChecker

ValueDefinitionChecker

nameinstructionbranchcomplexitylinemethod
ValueDefinitionChecker(ITypeCheckerAssistantFactory)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
caseAImportedDefinition(AImportedDefinition)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAInheritedDefinition(AInheritedDefinition)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseALocalDefinition(ALocalDefinition)
M: 0 C: 8
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseARenamedDefinition(ARenamedDefinition)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAValueDefinition(AValueDefinition)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(INode)
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(Object)
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
defaultPDefinition(PDefinition)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 2 C: 6
75%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package org.overture.typechecker.utilities;
2:
3: import org.overture.ast.analysis.AnalysisException;
4: import org.overture.ast.analysis.AnswerAdaptor;
5: import org.overture.ast.definitions.AImportedDefinition;
6: import org.overture.ast.definitions.AInheritedDefinition;
7: import org.overture.ast.definitions.ALocalDefinition;
8: import org.overture.ast.definitions.ARenamedDefinition;
9: import org.overture.ast.definitions.AValueDefinition;
10: import org.overture.ast.definitions.PDefinition;
11: import org.overture.ast.node.INode;
12: import org.overture.typechecker.assistant.ITypeCheckerAssistantFactory;
13:
14: /**
15: * This class implements a way to check if a node is a value definition.
16: */
17:•public class ValueDefinitionChecker extends AnswerAdaptor<Boolean>
18: {
19:         protected ITypeCheckerAssistantFactory af;
20:
21:         public ValueDefinitionChecker(ITypeCheckerAssistantFactory af)
22:         {
23:                 this.af = af;
24:         }
25:         
26:         @Override
27:         public Boolean caseAValueDefinition(AValueDefinition node) throws AnalysisException
28:         {
29:                 return true;
30:         }
31:         
32:         @Override
33:         public Boolean caseALocalDefinition(ALocalDefinition node) throws AnalysisException
34:         {
35:•                 return node.getValueDefinition() != null;
36:         }
37:         
38:         @Override
39:         public Boolean caseAImportedDefinition(AImportedDefinition node) throws AnalysisException
40:         {
41:                 return node.getDef().apply(this);
42:         }
43:         
44:         public Boolean caseAInheritedDefinition(AInheritedDefinition node) throws AnalysisException
45:         {
46:                 return node.getSuperdef().apply(this);
47:         };
48:
49:         @Override
50:         public Boolean caseARenamedDefinition(ARenamedDefinition node)
51:                 throws AnalysisException
52:         {
53:                 return node.getDef().apply(this);
54:         }
55:         
56:         @Override
57:         public Boolean defaultPDefinition(PDefinition node)
58:                         throws AnalysisException
59:         {
60:                 return false;
61:         }
62:
63:         @Override
64:         public Boolean createNewReturnValue(INode node)
65:         {
66:•                assert false : "should not happen";
67:                 return null;
68:         }
69:
70:         @Override
71:         public Boolean createNewReturnValue(Object node)
72:         {
73:•                assert false : "should not happen";
74:                 return null;
75:         }
76: }