Package: OldNameCollector

OldNameCollector

nameinstructionbranchcomplexitylinemethod
OldNameCollector(IInterpreterAssistantFactory)
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%
caseAApplyExp(AApplyExp)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
caseACaseAlternative(ACaseAlternative)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseACasesExp(ACasesExp)
M: 40 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseAElementsUnaryExp(AElementsUnaryExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAElseIfExp(AElseIfExp)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAEqualsDefinition(AEqualsDefinition)
M: 32 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
caseAExists1Exp(AExists1Exp)
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAExistsExp(AExistsExp)
M: 34 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
caseAFieldExp(AFieldExp)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAFieldNumberExp(AFieldNumberExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAForAllExp(AForAllExp)
M: 34 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
caseAFuncInstatiationExp(AFuncInstatiationExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAIfExp(AIfExp)
M: 50 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
caseAIotaExp(AIotaExp)
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAIsExp(AIsExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAIsOfBaseClassExp(AIsOfBaseClassExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAIsOfClassExp(AIsOfClassExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseALambdaExp(ALambdaExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseALetBeStExp(ALetBeStExp)
M: 29 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseALetDefExp(ALetDefExp)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
caseAMapCompMapExp(AMapCompMapExp)
M: 40 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseAMapEnumMapExp(AMapEnumMapExp)
M: 26 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseAMapletExp(AMapletExp)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAMkBasicExp(AMkBasicExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAMkTypeExp(AMkTypeExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAMuExp(AMuExp)
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseANarrowExp(ANarrowExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseANewExp(ANewExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAPostOpExp(APostOpExp)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseARecordModifier(ARecordModifier)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseASameBaseClassExp(ASameBaseClassExp)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseASameClassExp(ASameClassExp)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseASeqCompSeqExp(ASeqCompSeqExp)
M: 29 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
caseASeqEnumSeqExp(ASeqEnumSeqExp)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseASeqMultipleBind(ASeqMultipleBind)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseASetBind(ASetBind)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseASetCompSetExp(ASetCompSetExp)
M: 40 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseASetEnumSetExp(ASetEnumSetExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseASetMultipleBind(ASetMultipleBind)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseASubseqExp(ASubseqExp)
M: 27 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseATupleExp(ATupleExp)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseATypeMultipleBind(ATypeMultipleBind)
M: 4 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: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseAVariableExp(AVariableExp)
M: 0 C: 14
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
createNewReturnValue(INode)
M: 11 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: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
defaultPBind(PBind)
M: 25 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
defaultPDefinition(PDefinition)
M: 20 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
defaultPExp(PExp)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
defaultPMultipleBind(PMultipleBind)
M: 25 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
defaultSBinaryExp(SBinaryExp)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
defaultSSetExp(SSetExp)
M: 15 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
defaultSUnaryExp(SUnaryExp)
M: 5 C: 10
67%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
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.interpreter.utilities;
2:
3: import org.overture.ast.analysis.AnalysisException;
4: import org.overture.ast.analysis.AnswerAdaptor;
5: import org.overture.ast.definitions.AEqualsDefinition;
6: import org.overture.ast.definitions.AValueDefinition;
7: import org.overture.ast.definitions.PDefinition;
8: import org.overture.ast.expressions.AApplyExp;
9: import org.overture.ast.expressions.ACaseAlternative;
10: import org.overture.ast.expressions.ACasesExp;
11: import org.overture.ast.expressions.AElementsUnaryExp;
12: import org.overture.ast.expressions.AElseIfExp;
13: import org.overture.ast.expressions.AExists1Exp;
14: import org.overture.ast.expressions.AExistsExp;
15: import org.overture.ast.expressions.AFieldExp;
16: import org.overture.ast.expressions.AFieldNumberExp;
17: import org.overture.ast.expressions.AForAllExp;
18: import org.overture.ast.expressions.AFuncInstatiationExp;
19: import org.overture.ast.expressions.AIfExp;
20: import org.overture.ast.expressions.AIotaExp;
21: import org.overture.ast.expressions.AIsExp;
22: import org.overture.ast.expressions.AIsOfBaseClassExp;
23: import org.overture.ast.expressions.AIsOfClassExp;
24: import org.overture.ast.expressions.ALambdaExp;
25: import org.overture.ast.expressions.ALetBeStExp;
26: import org.overture.ast.expressions.ALetDefExp;
27: import org.overture.ast.expressions.AMapCompMapExp;
28: import org.overture.ast.expressions.AMapEnumMapExp;
29: import org.overture.ast.expressions.AMapletExp;
30: import org.overture.ast.expressions.AMkBasicExp;
31: import org.overture.ast.expressions.AMkTypeExp;
32: import org.overture.ast.expressions.AMuExp;
33: import org.overture.ast.expressions.ANarrowExp;
34: import org.overture.ast.expressions.ANewExp;
35: import org.overture.ast.expressions.APostOpExp;
36: import org.overture.ast.expressions.ARecordModifier;
37: import org.overture.ast.expressions.ASameBaseClassExp;
38: import org.overture.ast.expressions.ASameClassExp;
39: import org.overture.ast.expressions.ASeqCompSeqExp;
40: import org.overture.ast.expressions.ASeqEnumSeqExp;
41: import org.overture.ast.expressions.ASetCompSetExp;
42: import org.overture.ast.expressions.ASetEnumSetExp;
43: import org.overture.ast.expressions.ASubseqExp;
44: import org.overture.ast.expressions.ATupleExp;
45: import org.overture.ast.expressions.AVariableExp;
46: import org.overture.ast.expressions.PExp;
47: import org.overture.ast.expressions.SBinaryExp;
48: import org.overture.ast.expressions.SSetExp;
49: import org.overture.ast.expressions.SUnaryExp;
50: import org.overture.ast.lex.LexNameList;
51: import org.overture.ast.node.INode;
52: import org.overture.ast.patterns.ASeqMultipleBind;
53: import org.overture.ast.patterns.ASetBind;
54: import org.overture.ast.patterns.ASetMultipleBind;
55: import org.overture.ast.patterns.ATypeBind;
56: import org.overture.ast.patterns.ATypeMultipleBind;
57: import org.overture.ast.patterns.PBind;
58: import org.overture.ast.patterns.PMultipleBind;
59: import org.overture.interpreter.assistant.IInterpreterAssistantFactory;
60:
61: /**
62: * This class implements a way collect the old names from expressions
63: *
64: * @author kel
65: */
66:•public class OldNameCollector extends AnswerAdaptor<LexNameList>
67: {
68:
69:         protected IInterpreterAssistantFactory af;
70:
71:         public OldNameCollector(IInterpreterAssistantFactory af)
72:         {
73:                 this.af = af;
74:         }
75:
76:         public LexNameList caseAApplyExp(AApplyExp expression)
77:                         throws org.overture.ast.analysis.AnalysisException
78:         {
79:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getArgs());
80:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getRoot()));
81:                 return list;
82:         }
83:
84:         public LexNameList defaultSBinaryExp(SBinaryExp expression)
85:                         throws org.overture.ast.analysis.AnalysisException
86:         {
87:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getLeft());
88:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getRight()));
89:                 return list;
90:         }
91:
92:         public LexNameList caseACasesExp(ACasesExp expression)
93:                         throws org.overture.ast.analysis.AnalysisException
94:         {
95:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getExpression());
96:
97:•                for (ACaseAlternative c : expression.getCases())
98:                 {
99:                         list.addAll(c.apply(this));
100:                 }
101:
102:•                if (expression.getOthers() != null)
103:                 {
104:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getOthers()));
105:                 }
106:
107:                 return list;
108:         }
109:
110:         public LexNameList caseAElseIfExp(AElseIfExp expression)
111:                         throws org.overture.ast.analysis.AnalysisException
112:         {
113:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getElseIf());
114:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getThen()));
115:                 return list;
116:         }
117:
118:         public LexNameList caseAExistsExp(AExistsExp expression)
119:                         throws org.overture.ast.analysis.AnalysisException
120:         {
121:                 LexNameList list = new LexNameList();
122:
123:•                for (PMultipleBind mb : expression.getBindList())
124:                 {
125:                         list.addAll(mb.apply(this));
126:                 }
127:
128:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
129:                 return list;
130:         }
131:
132:         public LexNameList caseAExists1Exp(AExists1Exp expression)
133:                         throws org.overture.ast.analysis.AnalysisException
134:         {
135:                 LexNameList list = expression.getBind().apply(this);
136:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
137:                 return list;
138:         }
139:
140:         public LexNameList caseAFieldExp(AFieldExp expression)
141:                         throws org.overture.ast.analysis.AnalysisException
142:         {
143:                 return af.createPExpAssistant().getOldNames(expression.getObject());
144:         }
145:
146:         public LexNameList caseAFieldNumberExp(AFieldNumberExp expression)
147:                         throws org.overture.ast.analysis.AnalysisException
148:         {
149:                 return af.createPExpAssistant().getOldNames(expression.getTuple());
150:         }
151:
152:         public LexNameList caseAForAllExp(AForAllExp expression)
153:                         throws org.overture.ast.analysis.AnalysisException
154:         {
155:                 LexNameList list = new LexNameList();
156:
157:•                for (PMultipleBind mb : expression.getBindList())
158:                 {
159:                         list.addAll(mb.apply(this));
160:                 }
161:
162:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
163:                 return list;
164:         }
165:
166:         public LexNameList caseAFuncInstatiationExp(AFuncInstatiationExp expression)
167:                         throws org.overture.ast.analysis.AnalysisException
168:         {
169:                 return af.createPExpAssistant().getOldNames(expression.getFunction());
170:         }
171:
172:         public LexNameList caseAIfExp(AIfExp expression)
173:                         throws org.overture.ast.analysis.AnalysisException
174:         {
175:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getTest());
176:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getThen()));
177:
178:•                for (AElseIfExp elif : expression.getElseList())
179:                 {
180:                         list.addAll(af.createPExpAssistant().getOldNames(elif));
181:                 }
182:
183:•                if (expression.getElse() != null)
184:                 {
185:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getElse()));
186:                 }
187:
188:                 return list;
189:         }
190:
191:         public LexNameList caseAIotaExp(AIotaExp expression)
192:                         throws org.overture.ast.analysis.AnalysisException
193:         {
194:                 LexNameList list = expression.getBind().apply(this);
195:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
196:                 return list;
197:         }
198:
199:         public LexNameList caseAIsExp(AIsExp expression)
200:                         throws org.overture.ast.analysis.AnalysisException
201:         {
202:                 return af.createPExpAssistant().getOldNames(expression.getTest());
203:         }
204:
205:         public LexNameList caseAIsOfBaseClassExp(AIsOfBaseClassExp expression)
206:                         throws org.overture.ast.analysis.AnalysisException
207:         {
208:                 return af.createPExpAssistant().getOldNames(expression.getExp());
209:         }
210:
211:         public LexNameList caseAIsOfClassExp(AIsOfClassExp expression)
212:                         throws org.overture.ast.analysis.AnalysisException
213:         {
214:                 return af.createPExpAssistant().getOldNames(expression.getExp());
215:         }
216:
217:         public LexNameList caseALambdaExp(ALambdaExp expression)
218:                         throws org.overture.ast.analysis.AnalysisException
219:         {
220:                 return af.createPExpAssistant().getOldNames(expression.getExpression());
221:         }
222:
223:         public LexNameList caseALetBeStExp(ALetBeStExp expression)
224:                         throws org.overture.ast.analysis.AnalysisException
225:         {
226:                 LexNameList list = expression.getBind().apply(this);
227:
228:•                if (expression.getSuchThat() != null)
229:                 {
230:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getSuchThat()));
231:                 }
232:
233:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getValue()));
234:                 return list;
235:         }
236:
237:         public LexNameList caseALetDefExp(ALetDefExp expression)
238:                         throws org.overture.ast.analysis.AnalysisException
239:         {
240:                 LexNameList list = af.createPDefinitionListAssistant().getOldNames(expression.getLocalDefs());
241:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getExpression()));
242:                 return list;
243:         }
244:
245:         // public LexNameList defaultSMapExp(SMapExp expression)
246:         // throws org.overture.ast.analysis.AnalysisException
247:         // {
248:         // if (expression instanceof AMapCompMapExp)
249:         // {
250:         // return expression.apply(this);
251:         // } else if (expression instanceof AMapEnumMapExp)
252:         // {
253:         // return AMapEnumMapExpAssistantTC.getOldNames((AMapEnumMapExp) expression);
254:         // } else
255:         // {
256:         // assert false : "Should not happen";
257:         // return new LexNameList();
258:         // }
259:         // }
260:
261:         public LexNameList caseAMapletExp(AMapletExp expression)
262:                         throws org.overture.ast.analysis.AnalysisException
263:         {
264:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getLeft());
265:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getRight()));
266:                 return list;
267:         }
268:
269:         public LexNameList caseAMkBasicExp(AMkBasicExp expression)
270:                         throws org.overture.ast.analysis.AnalysisException
271:         {
272:                 return af.createPExpAssistant().getOldNames(expression.getArg());
273:         }
274:
275:         public LexNameList caseAMkTypeExp(AMkTypeExp expression)
276:                         throws org.overture.ast.analysis.AnalysisException
277:         {
278:                 return af.createPExpAssistant().getOldNames(expression.getArgs());
279:         }
280:
281:         public LexNameList caseAMuExp(AMuExp expression)
282:                         throws org.overture.ast.analysis.AnalysisException
283:         {
284:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getRecord());
285:
286:•                for (ARecordModifier rm : expression.getModifiers())
287:                 {
288:                         list.addAll(rm.apply(this));
289:                 }
290:
291:                 return list;
292:         }
293:
294:         public LexNameList caseANarrowExp(ANarrowExp expression)
295:                         throws org.overture.ast.analysis.AnalysisException
296:         {
297:                 return af.createPExpAssistant().getOldNames(expression.getTest());
298:         }
299:
300:         public LexNameList caseANewExp(ANewExp expression)
301:                         throws org.overture.ast.analysis.AnalysisException
302:         {
303:                 return af.createPExpAssistant().getOldNames(expression.getArgs());
304:         }
305:
306:         public LexNameList caseAPostOpExp(APostOpExp expression)
307:                         throws org.overture.ast.analysis.AnalysisException
308:         {
309:                 return af.createPExpAssistant().getOldNames(expression.getPostexpression());
310:         }
311:
312:         public LexNameList caseASameBaseClassExp(ASameBaseClassExp expression)
313:                         throws org.overture.ast.analysis.AnalysisException
314:         {
315:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getLeft());
316:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getRight()));
317:                 return list;
318:         }
319:
320:         public LexNameList caseASameClassExp(ASameClassExp expression)
321:                         throws org.overture.ast.analysis.AnalysisException
322:         {
323:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getLeft());
324:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getRight()));
325:                 return list;
326:         }
327:
328:         // public LexNameList defaultSSeqExp(SSeqExp expression)
329:         // throws org.overture.ast.analysis.AnalysisException
330:         // {
331:         // if (expression instanceof ASeqCompSeqExp)
332:         // {
333:         // return ASeqCompSeqExpAssistantTC.getOldNames((ASeqCompSeqExp) expression);
334:         // } else if (expression instanceof ASeqEnumSeqExp)
335:         // {
336:         // return ASeqEnumSeqExpAssistantTC.getOldNames((ASeqEnumSeqExp) expression);
337:         // } else
338:         // {
339:         // assert false : "Should not happen";
340:         // return new LexNameList();
341:         // }
342:         // }
343:
344:         public LexNameList defaultSSetExp(SSetExp expression)
345:                         throws org.overture.ast.analysis.AnalysisException
346:         {
347:•                if (expression instanceof ASetCompSetExp
348:                                 || expression instanceof ASetEnumSetExp)
349:                 {
350:                         return expression.apply(this);
351:                 } else
352:                 {
353:                         return new LexNameList();
354:                 }
355:         }
356:
357:         public LexNameList caseASubseqExp(ASubseqExp expression)
358:                         throws org.overture.ast.analysis.AnalysisException
359:         {
360:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getSeq());
361:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getFrom()));
362:                 list.addAll(af.createPExpAssistant().getOldNames(expression.getTo()));
363:                 return list;
364:         }
365:
366:         public LexNameList caseATupleExp(ATupleExp expression)
367:                         throws org.overture.ast.analysis.AnalysisException
368:         {
369:                 return af.createPExpAssistant().getOldNames(expression.getArgs());
370:         }
371:
372:         public LexNameList defaultSUnaryExp(SUnaryExp expression)
373:                         throws org.overture.ast.analysis.AnalysisException
374:         {
375:•                if (expression instanceof AElementsUnaryExp)
376:                 {
377:                         return expression.apply(this);
378:                 } else
379:                 {
380:                         return af.createPExpAssistant().getOldNames(expression.getExp());
381:                 }
382:         }
383:
384:         @Override
385:         public LexNameList caseAElementsUnaryExp(AElementsUnaryExp expression)
386:                         throws AnalysisException
387:         {
388:                 return af.createPExpAssistant().getOldNames(expression.getExp());
389:         }
390:
391:         @Override
392:         public LexNameList caseAMapCompMapExp(AMapCompMapExp expression)
393:                         throws AnalysisException
394:         {
395:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getFirst());
396:
397:•                for (PMultipleBind mb : expression.getBindings())
398:                 {
399:                         list.addAll(mb.apply(this));
400:                 }
401:
402:•                if (expression.getPredicate() != null)
403:                 {
404:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
405:                 }
406:
407:                 return list;
408:         }
409:
410:         @Override
411:         public LexNameList caseAMapEnumMapExp(AMapEnumMapExp expression)
412:                         throws AnalysisException
413:         {
414:                 LexNameList list = new LexNameList();
415:
416:•                for (AMapletExp maplet : expression.getMembers())
417:                 {
418:                         list.addAll(af.createPExpAssistant().getOldNames(maplet));
419:                 }
420:
421:                 return list;
422:         }
423:
424:         @Override
425:         public LexNameList caseASeqCompSeqExp(ASeqCompSeqExp expression)
426:                         throws AnalysisException
427:         {
428:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getFirst());
429:                 list.addAll(expression.getBind().apply(this));
430:
431:•                if (expression.getPredicate() != null)
432:                 {
433:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
434:                 }
435:
436:                 return list;
437:         }
438:
439:         @Override
440:         public LexNameList caseASetCompSetExp(ASetCompSetExp expression)
441:                         throws AnalysisException
442:         {
443:                 LexNameList list = af.createPExpAssistant().getOldNames(expression.getFirst());
444:
445:•                for (PMultipleBind mb : expression.getBindings())
446:                 {
447:                         list.addAll(mb.apply(this));
448:                 }
449:
450:•                if (expression.getPredicate() != null)
451:                 {
452:                         list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate()));
453:                 }
454:
455:                 return list;
456:         }
457:
458:         @Override
459:         public LexNameList caseASetEnumSetExp(ASetEnumSetExp expression)
460:                         throws AnalysisException
461:         {
462:                 return af.createPExpAssistant().getOldNames(expression.getMembers());
463:         }
464:
465:         @Override
466:         public LexNameList caseASeqEnumSeqExp(ASeqEnumSeqExp expression)
467:                         throws AnalysisException
468:         {
469:                 return af.createPExpAssistant().getOldNames(expression.getMembers());
470:         }
471:
472:         /**
473:          * This is not an expression
474:          */
475:         @Override
476:         public LexNameList caseACaseAlternative(ACaseAlternative c)
477:                         throws AnalysisException
478:         {
479:                 return af.createPExpAssistant().getOldNames(c.getResult());
480:         }
481:
482:         /**
483:          * This is not an expression
484:          */
485:         @Override
486:         public LexNameList caseARecordModifier(ARecordModifier rm)
487:                         throws AnalysisException
488:         {
489:                 return af.createPExpAssistant().getOldNames(rm.getValue());
490:         }
491:
492:         @Override
493:         public LexNameList caseASetBind(ASetBind bind) throws AnalysisException
494:         {
495:                 return af.createPExpAssistant().getOldNames(bind.getSet());
496:         }
497:
498:         @Override
499:         public LexNameList caseASetMultipleBind(ASetMultipleBind mb)
500:                         throws AnalysisException
501:         {
502:                 return af.createPExpAssistant().getOldNames(mb.getSet());
503:         }
504:
505:         @Override
506:         public LexNameList caseASeqMultipleBind(ASeqMultipleBind mb)
507:                         throws AnalysisException
508:         {
509:                 return af.createPExpAssistant().getOldNames(mb.getSeq());
510:         }
511:
512:         @Override
513:         public LexNameList defaultPBind(PBind bind) throws AnalysisException
514:         {
515:•                if (bind instanceof ASetBind)
516:                 {
517:                         return bind.apply(this);
518:•                } else if (bind instanceof ATypeBind)
519:                 {
520:                         return bind.apply(this);
521:                 } else
522:                 {
523:•                        assert false : "Should not happen";
524:                         return null;
525:                 }
526:         }
527:
528:         @Override
529:         public LexNameList defaultPMultipleBind(PMultipleBind mb)
530:                         throws AnalysisException
531:         {
532:•                if (mb instanceof ASetMultipleBind)
533:                 {
534:                         return mb.apply(this);
535:•                } else if (mb instanceof ATypeMultipleBind)
536:                 {
537:                         return mb.apply(this);
538:                 } else
539:                 {
540:•                        assert false : "Should not happen";
541:                         return null;
542:                 }
543:         }
544:
545:         @Override
546:         public LexNameList caseAEqualsDefinition(AEqualsDefinition def)
547:                         throws AnalysisException
548:         {
549:                 LexNameList list = af.createPExpAssistant().getOldNames(def.getTest());
550:
551:•                if (def.getSetbind() != null)
552:                 {
553:                         list.addAll(def.getSetbind().apply(this));
554:                 }
555:•                else if (def.getSeqbind() != null)
556:                 {
557:                         list.addAll(def.getSeqbind().apply(this));
558:                 }
559:
560:                 return list;
561:         }
562:
563:         @Override
564:         public LexNameList caseATypeMultipleBind(ATypeMultipleBind node)
565:                         throws AnalysisException
566:         {
567:                 return new LexNameList();
568:         }
569:
570:         @Override
571:         public LexNameList caseAValueDefinition(AValueDefinition def)
572:                         throws AnalysisException
573:         {
574:                 return af.createPExpAssistant().getOldNames(def.getExpression());
575:         }
576:
577:         @Override
578:         public LexNameList defaultPDefinition(PDefinition d)
579:                         throws AnalysisException
580:         {
581:•                if (d instanceof AEqualsDefinition)
582:                 {
583:                         return d.apply(this);
584:•                } else if (d instanceof AValueDefinition)
585:                 {
586:                         return d.apply(this);
587:                 } else
588:                 {
589:                         return new LexNameList();
590:                 }
591:         }
592:
593:         @Override
594:         public LexNameList caseAVariableExp(AVariableExp expression)
595:                         throws AnalysisException
596:         {
597:•                if (expression.getName().getOld())
598:                 {
599:                         return new LexNameList(expression.getName());
600:                 } else
601:                 {
602:                         return new LexNameList();
603:                 }
604:         }
605:
606:         @Override
607:         public LexNameList defaultPExp(PExp node) throws AnalysisException
608:         {
609:                 return new LexNameList();
610:         }
611:
612:         @Override
613:         public LexNameList createNewReturnValue(INode node)
614:         {
615:•                assert false : "Should not happen";
616:                 return new LexNameList();
617:         }
618:
619:         @Override
620:         public LexNameList createNewReturnValue(Object node)
621:         {
622:•                assert false : "Should not happen";
623:                 return new LexNameList();
624:         }
625: }