Package: PatternUnresolver

PatternUnresolver

nameinstructionbranchcomplexitylinemethod
PatternUnresolver(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%
caseAConcatenationPattern(AConcatenationPattern)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAMapPattern(AMapPattern)
M: 21 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseAMapUnionPattern(AMapUnionPattern)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseARecordPattern(ARecordPattern)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
caseASeqPattern(ASeqPattern)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseASetPattern(ASetPattern)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseATuplePattern(ATuplePattern)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAUnionPattern(AUnionPattern)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
defaultPPattern(PPattern)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * The VDM Type Checker
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.typechecker.utilities.pattern;
23:
24: import org.overture.ast.analysis.AnalysisAdaptor;
25: import org.overture.ast.analysis.AnalysisException;
26: import org.overture.ast.patterns.AConcatenationPattern;
27: import org.overture.ast.patterns.AMapPattern;
28: import org.overture.ast.patterns.AMapUnionPattern;
29: import org.overture.ast.patterns.AMapletPatternMaplet;
30: import org.overture.ast.patterns.ARecordPattern;
31: import org.overture.ast.patterns.ASeqPattern;
32: import org.overture.ast.patterns.ASetPattern;
33: import org.overture.ast.patterns.ATuplePattern;
34: import org.overture.ast.patterns.AUnionPattern;
35: import org.overture.ast.patterns.PPattern;
36: import org.overture.typechecker.assistant.ITypeCheckerAssistantFactory;
37:
38: /**
39: * This class set a pattern to unresolved.
40: *
41: * @author kel
42: */
43: public class PatternUnresolver extends AnalysisAdaptor
44: {
45:         protected ITypeCheckerAssistantFactory af;
46:
47:         public PatternUnresolver(ITypeCheckerAssistantFactory af)
48:         {
49:                 this.af = af;
50:         }
51:
52:         @Override
53:         public void caseAConcatenationPattern(AConcatenationPattern pattern)
54:                         throws AnalysisException
55:         {
56:                 pattern.getLeft().apply(THIS);
57:                 pattern.getRight().apply(THIS);
58:                 pattern.setResolved(false);
59:         }
60:
61:         @Override
62:         public void caseARecordPattern(ARecordPattern pattern)
63:                         throws AnalysisException
64:         {
65:                 pattern.getType().apply(THIS);
66:                 pattern.setResolved(false);
67:         }
68:
69:         @Override
70:         public void caseASeqPattern(ASeqPattern pattern) throws AnalysisException
71:         {
72:                 af.createPPatternListAssistant().unResolve(pattern.getPlist());
73:                 pattern.setResolved(false);
74:         }
75:
76:         @Override
77:         public void caseASetPattern(ASetPattern pattern) throws AnalysisException
78:         {
79:                 af.createPPatternListAssistant().unResolve(pattern.getPlist());
80:                 pattern.setResolved(false);
81:         }
82:
83:         @Override
84:         public void caseATuplePattern(ATuplePattern pattern)
85:                         throws AnalysisException
86:         {
87:                 af.createPPatternListAssistant().unResolve(pattern.getPlist());
88:                 pattern.setResolved(false);
89:         }
90:
91:         @Override
92:         public void caseAUnionPattern(AUnionPattern pattern)
93:                         throws AnalysisException
94:         {
95:                 pattern.getLeft().apply(THIS);
96:                 pattern.getRight().apply(THIS);
97:                 pattern.setResolved(false);
98:         }
99:
100:         @Override
101:         public void caseAMapUnionPattern(AMapUnionPattern pattern)
102:                         throws AnalysisException
103:         {
104:                 pattern.getLeft().apply(THIS);
105:                 pattern.getRight().apply(THIS);
106:                 pattern.setResolved(false);
107:         }
108:
109:         @Override
110:         public void caseAMapPattern(AMapPattern pattern) throws AnalysisException
111:         {
112:•                for (AMapletPatternMaplet mp : pattern.getMaplets())
113:                 {
114:                         // af.createAMapletPatternMapletAssistant().unResolve(mp);
115:                         mp.apply(THIS);
116:                 }
117:                 pattern.setResolved(false);
118:         }
119:
120:         @Override
121:         public void defaultPPattern(PPattern pattern) throws AnalysisException
122:         {
123:                 pattern.setResolved(false);
124:         }
125: }