Package: ExpExpressionFinder

ExpExpressionFinder

nameinstructionbranchcomplexitylinemethod
ExpExpressionFinder(IInterpreterAssistantFactory)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAApplyExp(AApplyExp, Integer)
M: 30 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseACasesExp(ACasesExp, Integer)
M: 61 C: 0
0%
M: 12 C: 0
0%
M: 7 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
caseADefExp(ADefExp, Integer)
M: 30 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseAElseIfExp(AElseIfExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAExists1Exp(AExists1Exp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAExistsExp(AExistsExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAFieldExp(AFieldExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAFieldNumberExp(AFieldNumberExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAForAllExp(AForAllExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAFuncInstatiationExp(AFuncInstatiationExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAIfExp(AIfExp, Integer)
M: 69 C: 0
0%
M: 12 C: 0
0%
M: 7 C: 0
0%
M: 17 C: 0
0%
M: 1 C: 0
0%
caseAIotaExp(AIotaExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAIsExp(AIsExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAIsOfBaseClassExp(AIsOfBaseClassExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAIsOfClassExp(AIsOfClassExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseALambdaExp(ALambdaExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseALetBeStExp(ALetBeStExp, Integer)
M: 32 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
caseALetDefExp(ALetDefExp, Integer)
M: 30 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
caseAMapCompMapExp(AMapCompMapExp, Integer)
M: 34 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
caseAMapEnumMapExp(AMapEnumMapExp, Integer)
M: 34 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
caseAMapletExp(AMapletExp, Integer)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
caseAMkBasicExp(AMkBasicExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAMkTypeExp(AMkTypeExp, Integer)
M: 18 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAMuExp(AMuExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseANarrowExp(ANarrowExp, Integer)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseANewExp(ANewExp, Integer)
M: 18 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAPostOpExp(APostOpExp, Integer)
M: 8 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, Integer)
M: 35 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
caseASameClassExp(ASameClassExp, Integer)
M: 35 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
caseASeqCompSeqExp(ASeqCompSeqExp, Integer)
M: 34 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
caseASeqEnumSeqExp(ASeqEnumSeqExp, Integer)
M: 18 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseASetCompSetExp(ASetCompSetExp, Integer)
M: 34 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
caseASetEnumSetExp(ASetEnumSetExp, Integer)
M: 18 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseASetRangeSetExp(ASetRangeSetExp, Integer)
M: 35 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
caseASubseqExp(ASubseqExp, Integer)
M: 47 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
caseATupleExp(ATupleExp, Integer)
M: 18 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(INode, Integer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(Object, Integer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultPExp(PExp, Integer)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultSBinaryExp(SBinaryExp, Integer)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
defaultSMapExp(SMapExp, Integer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultSSeqExp(SSeqExp, Integer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultSSetExp(SSetExp, Integer)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultSUnaryExp(SUnaryExp, Integer)
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
findExpressionBaseCase(PExp, int)
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package org.overture.interpreter.utilities.expression;
2:
3: import org.overture.ast.analysis.AnalysisException;
4: import org.overture.ast.analysis.QuestionAnswerAdaptor;
5: import org.overture.ast.expressions.AApplyExp;
6: import org.overture.ast.expressions.ACaseAlternative;
7: import org.overture.ast.expressions.ACasesExp;
8: import org.overture.ast.expressions.ADefExp;
9: import org.overture.ast.expressions.AElseIfExp;
10: import org.overture.ast.expressions.AExists1Exp;
11: import org.overture.ast.expressions.AExistsExp;
12: import org.overture.ast.expressions.AFieldExp;
13: import org.overture.ast.expressions.AFieldNumberExp;
14: import org.overture.ast.expressions.AForAllExp;
15: import org.overture.ast.expressions.AFuncInstatiationExp;
16: import org.overture.ast.expressions.AIfExp;
17: import org.overture.ast.expressions.AIotaExp;
18: import org.overture.ast.expressions.AIsExp;
19: import org.overture.ast.expressions.AIsOfBaseClassExp;
20: import org.overture.ast.expressions.AIsOfClassExp;
21: import org.overture.ast.expressions.ALambdaExp;
22: import org.overture.ast.expressions.ALetBeStExp;
23: import org.overture.ast.expressions.ALetDefExp;
24: import org.overture.ast.expressions.AMapCompMapExp;
25: import org.overture.ast.expressions.AMapEnumMapExp;
26: import org.overture.ast.expressions.AMapletExp;
27: import org.overture.ast.expressions.AMkBasicExp;
28: import org.overture.ast.expressions.AMkTypeExp;
29: import org.overture.ast.expressions.AMuExp;
30: import org.overture.ast.expressions.ANarrowExp;
31: import org.overture.ast.expressions.ANewExp;
32: import org.overture.ast.expressions.APostOpExp;
33: import org.overture.ast.expressions.ASameBaseClassExp;
34: import org.overture.ast.expressions.ASameClassExp;
35: import org.overture.ast.expressions.ASeqCompSeqExp;
36: import org.overture.ast.expressions.ASeqEnumSeqExp;
37: import org.overture.ast.expressions.ASetCompSetExp;
38: import org.overture.ast.expressions.ASetEnumSetExp;
39: import org.overture.ast.expressions.ASetRangeSetExp;
40: import org.overture.ast.expressions.ASubseqExp;
41: import org.overture.ast.expressions.ATupleExp;
42: import org.overture.ast.expressions.PExp;
43: import org.overture.ast.expressions.SBinaryExp;
44: import org.overture.ast.expressions.SMapExp;
45: import org.overture.ast.expressions.SSeqExp;
46: import org.overture.ast.expressions.SSetExp;
47: import org.overture.ast.expressions.SUnaryExp;
48: import org.overture.ast.node.INode;
49: import org.overture.interpreter.assistant.IInterpreterAssistantFactory;
50:
51: /***************************************
52: * This method find an expression in an expression. //that's what i think it does, check to change to correct form if
53: * needed.
54: *
55: * @author gkanos
56: ****************************************/
57:
58: public class ExpExpressionFinder extends QuestionAnswerAdaptor<Integer, PExp>
59: {
60:         protected IInterpreterAssistantFactory af;
61:
62:         public ExpExpressionFinder(IInterpreterAssistantFactory af)
63:         {
64:                 this.af = af;
65:         }
66:
67:         @Override
68:         public PExp caseAApplyExp(AApplyExp exp, Integer lineno)
69:                         throws AnalysisException
70:         {
71:                 PExp found = findExpressionBaseCase(exp, lineno);
72:•                if (found != null)
73:                 {
74:                         return found;
75:                 }
76:
77:                 found = exp.getRoot().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getRoot(), lineno);
78:•                if (found != null)
79:                 {
80:                         return found;
81:                 }
82:
83:                 return af.createPExpAssistant().findExpression(exp.getArgs(), lineno);
84:         }
85:
86:         @Override
87:         public PExp defaultSBinaryExp(SBinaryExp exp, Integer lineno)
88:                         throws AnalysisException
89:         {
90:                 PExp found = exp.getLeft().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getLeft(),
91:                                                                                                                 // lineno);
92:•                if (found != null)
93:                 {
94:                         return found;
95:                 }
96:
97:                 return exp.getRight().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getRight(), lineno);
98:         }
99:
100:         @Override
101:         public PExp caseACasesExp(ACasesExp exp, Integer lineno)
102:                         throws AnalysisException
103:         {
104:                 PExp found = findExpressionBaseCase(exp, lineno);
105:•                if (found != null)
106:                 {
107:                         return found;
108:                 }
109:
110:                 found = exp.getExpression().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getExpression(),
111:                                                                                                                 // lineno);
112:•                if (found != null)
113:                 {
114:                         return found;
115:                 }
116:
117:•                for (ACaseAlternative c : exp.getCases())
118:                 {
119:                         found = c.getResult().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(c.getResult(), lineno);
120:•                        if (found != null)
121:                         {
122:                                 break;
123:                         }
124:                 }
125:
126:•                return found != null ? found
127:•                                : exp.getOthers() != null ? exp.getOthers().apply(THIS, lineno)// PExpAssistantInterpreter.findExpression(exp.getOthers(),
128:                                                                                                                                                                 // lineno)
129:                                                 : null;
130:         }
131:
132:         @Override
133:         public PExp caseADefExp(ADefExp exp, Integer lineno)
134:                         throws AnalysisException
135:         {
136:
137:                 PExp found = findExpressionBaseCase(exp, lineno);
138:•                if (found != null)
139:                 {
140:                         return found;
141:                 }
142:
143:                 found = af.createPDefinitionListAssistant().findExpression(exp.getLocalDefs(), lineno);
144:•                if (found != null)
145:                 {
146:                         return found;
147:                 }
148:
149:                 return exp.getExpression().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getExpression(),
150:                                                                                                                 // lineno);
151:         }
152:
153:         @Override
154:         public PExp caseAElseIfExp(AElseIfExp exp, Integer lineno)
155:                         throws AnalysisException
156:         {
157:                 PExp found = findExpressionBaseCase(exp, lineno);
158:•                if (found != null)
159:                 {
160:                         return found;
161:                 }
162:
163:                 return exp.getThen().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getThen(), lineno);
164:         }
165:
166:         @Override
167:         public PExp caseAExistsExp(AExistsExp exp, Integer lineno)
168:                         throws AnalysisException
169:         {
170:                 PExp found = findExpressionBaseCase(exp, lineno);
171:•                if (found != null)
172:                 {
173:                         return found;
174:                 }
175:
176:                 return exp.getPredicate().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getPredicate(),
177:                                                                                                                 // lineno);
178:         }
179:
180:         @Override
181:         public PExp caseAExists1Exp(AExists1Exp exp, Integer lineno)
182:                         throws AnalysisException
183:         {
184:                 PExp found = findExpressionBaseCase(exp, lineno);
185:•                if (found != null)
186:                 {
187:                         return found;
188:                 }
189:
190:                 return exp.getPredicate().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getPredicate(),
191:                                                                                                                 // lineno);
192:         }
193:
194:         @Override
195:         public PExp caseAFieldExp(AFieldExp exp, Integer lineno)
196:                         throws AnalysisException
197:         {
198:                 PExp found = findExpressionBaseCase(exp, lineno);
199:•                if (found != null)
200:                 {
201:                         return found;
202:                 }
203:
204:                 return exp.getObject().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getObject(), lineno);
205:         }
206:
207:         @Override
208:         public PExp caseAFieldNumberExp(AFieldNumberExp exp, Integer lineno)
209:                         throws AnalysisException
210:         {
211:                 PExp found = findExpressionBaseCase(exp, lineno);
212:•                if (found != null)
213:                 {
214:                         return found;
215:                 }
216:
217:                 return exp.getTuple().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getTuple(), lineno);
218:         }
219:
220:         @Override
221:         public PExp caseAForAllExp(AForAllExp exp, Integer lineno)
222:                         throws AnalysisException
223:         {
224:                 PExp found = findExpressionBaseCase(exp, lineno);
225:•                if (found != null)
226:                 {
227:                         return found;
228:                 }
229:
230:                 return exp.getPredicate().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getPredicate(),
231:                                                                                                                 // lineno);
232:         }
233:
234:         @Override
235:         public PExp caseAFuncInstatiationExp(AFuncInstatiationExp exp,
236:                         Integer lineno) throws AnalysisException
237:         {
238:                 PExp found = findExpressionBaseCase(exp, lineno);
239:•                if (found != null)
240:                 {
241:                         return found;
242:                 }
243:
244:                 return exp.getFunction().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getFunction(),
245:                                                                                                                 // lineno);
246:         }
247:
248:         @Override
249:         public PExp caseAIfExp(AIfExp exp, Integer lineno) throws AnalysisException
250:         {
251:                 PExp found = findExpressionBaseCase(exp, lineno);
252:•                if (found != null)
253:                 {
254:                         return found;
255:                 }
256:                 found = exp.getTest().apply(THIS, lineno);
257:•                if (found != null)
258:                 {
259:                         return found;
260:                 }
261:                 found = exp.getThen().apply(THIS, lineno);
262:•                if (found != null)
263:                 {
264:                         return found;
265:                 }
266:
267:•                for (AElseIfExp stmt : exp.getElseList())
268:                 {
269:                         found = stmt.apply(THIS, lineno);
270:•                        if (found != null)
271:                         {
272:                                 return found;
273:                         }
274:                 }
275:
276:•                if (exp.getElse() != null)
277:                 {
278:                         found = exp.getElse().apply(THIS, lineno);
279:                 }
280:
281:                 return found;
282:         }
283:
284:         @Override
285:         public PExp caseAIotaExp(AIotaExp exp, Integer lineno)
286:                         throws AnalysisException
287:         {
288:
289:                 PExp found = findExpressionBaseCase(exp, lineno);
290:•                if (found != null)
291:                 {
292:                         return found;
293:                 }
294:
295:                 return exp.getPredicate().apply(THIS, lineno);
296:         }
297:
298:         @Override
299:         public PExp caseAIsExp(AIsExp exp, Integer lineno) throws AnalysisException
300:         {
301:
302:                 PExp found = findExpressionBaseCase(exp, lineno);
303:•                if (found != null)
304:                 {
305:                         return found;
306:                 }
307:
308:                 return exp.getTest().apply(THIS, lineno);
309:         }
310:
311:         @Override
312:         public PExp caseAIsOfBaseClassExp(AIsOfBaseClassExp exp, Integer lineno)
313:                         throws AnalysisException
314:         {
315:
316:                 PExp found = findExpressionBaseCase(exp, lineno);
317:•                if (found != null)
318:                 {
319:                         return found;
320:                 }
321:
322:                 return exp.getExp().apply(THIS, lineno);
323:         }
324:
325:         @Override
326:         public PExp caseAIsOfClassExp(AIsOfClassExp exp, Integer lineno)
327:                         throws AnalysisException
328:         {
329:
330:                 PExp found = findExpressionBaseCase(exp, lineno);
331:•                if (found != null)
332:                 {
333:                         return found;
334:                 }
335:
336:                 return exp.getExp().apply(THIS, lineno);
337:         }
338:
339:         @Override
340:         public PExp caseALambdaExp(ALambdaExp exp, Integer lineno)
341:                         throws AnalysisException
342:         {
343:
344:                 PExp found = findExpressionBaseCase(exp, lineno);
345:•                if (found != null)
346:                 {
347:                         return found;
348:                 }
349:
350:                 return exp.getExpression().apply(THIS, lineno);
351:         }
352:
353:         @Override
354:         public PExp caseALetBeStExp(ALetBeStExp exp, Integer lineno)
355:                         throws AnalysisException
356:         {
357:                 PExp found = findExpressionBaseCase(exp, lineno);
358:•                if (found != null)
359:                 {
360:                         return found;
361:                 }
362:
363:•                if (exp.getSuchThat() != null)
364:                 {
365:                         found = exp.getSuchThat().apply(THIS, lineno);
366:•                        if (found != null)
367:                         {
368:                                 return found;
369:                         }
370:                 }
371:
372:                 return exp.getValue().apply(THIS, lineno);
373:         }
374:
375:         @Override
376:         public PExp caseALetDefExp(ALetDefExp exp, Integer lineno)
377:                         throws AnalysisException
378:         {
379:                 PExp found = findExpressionBaseCase(exp, lineno);
380:•                if (found != null)
381:                 {
382:                         return found;
383:                 }
384:
385:                 found = af.createPDefinitionListAssistant().findExpression(exp.getLocalDefs(), lineno);
386:•                if (found != null)
387:                 {
388:                         return found;
389:                 }
390:
391:                 return exp.getExpression().apply(THIS, lineno);
392:         }
393:
394:         @Override
395:         public PExp caseAMapCompMapExp(AMapCompMapExp exp, Integer lineno)
396:                         throws AnalysisException
397:         {
398:                 PExp found = findExpressionBaseCase(exp, lineno);
399:•                if (found != null)
400:                 {
401:                         return found;
402:                 }
403:
404:                 found = exp.getFirst().apply(THIS, lineno);
405:•                if (found != null)
406:                 {
407:                         return found;
408:                 }
409:
410:•                return exp.getPredicate() == null ? null
411:                                 : exp.getPredicate().apply(THIS, lineno);
412:         }
413:
414:         @Override
415:         public PExp caseAMapEnumMapExp(AMapEnumMapExp exp, Integer lineno)
416:                         throws AnalysisException
417:         {
418:                 PExp found = findExpressionBaseCase(exp, lineno);
419:•                if (found != null)
420:                 {
421:                         return found;
422:                 }
423:
424:•                for (AMapletExp m : exp.getMembers())
425:                 {
426:                         found = m.apply(THIS, lineno);
427:•                        if (found != null)
428:                         {
429:                                 return found;
430:                         }
431:                 }
432:
433:                 return null;
434:         }
435:
436:         @Override
437:         public PExp defaultSMapExp(SMapExp exp, Integer lineno)
438:                         throws AnalysisException
439:         {
440:
441:                 return null;
442:         }
443:
444:         @Override
445:         public PExp caseAMapletExp(AMapletExp exp, Integer lineno)
446:                         throws AnalysisException
447:         {
448:                 PExp found = exp.getLeft().apply(THIS, lineno);
449:•                return found == null ? exp.getRight().apply(THIS, lineno) : found;
450:         }
451:
452:         @Override
453:         public PExp caseAMkBasicExp(AMkBasicExp exp, Integer lineno)
454:                         throws AnalysisException
455:         {
456:
457:                 PExp found = findExpressionBaseCase(exp, lineno);
458:•                if (found != null)
459:                 {
460:                         return found;
461:                 }
462:
463:                 return exp.getArg().apply(THIS, lineno);
464:         }
465:
466:         @Override
467:         public PExp caseAMkTypeExp(AMkTypeExp exp, Integer lineno)
468:                         throws AnalysisException
469:         {
470:
471:                 PExp found = findExpressionBaseCase(exp, lineno);
472:•                if (found != null)
473:                 {
474:                         return found;
475:                 }
476:
477:                 return af.createPExpAssistant().findExpression(exp.getArgs(), lineno);
478:         }
479:
480:         @Override
481:         public PExp caseAMuExp(AMuExp exp, Integer lineno) throws AnalysisException
482:         {
483:
484:                 PExp found = findExpressionBaseCase(exp, lineno);
485:•                if (found != null)
486:                 {
487:                         return found;
488:                 }
489:
490:                 return exp.getRecord().apply(THIS, lineno);
491:         }
492:
493:         @Override
494:         public PExp caseANarrowExp(ANarrowExp exp, Integer lineno)
495:                         throws AnalysisException
496:         {
497:
498:                 PExp found = af.createPExpAssistant().findExpression(exp, lineno);
499:
500:•                if (found != null)
501:                 {
502:                         return found;
503:                 }
504:
505:                 return exp.getTest().apply(THIS, lineno);
506:         }
507:
508:         @Override
509:         public PExp caseANewExp(ANewExp exp, Integer lineno)
510:                         throws AnalysisException
511:         {
512:
513:                 PExp found = findExpressionBaseCase(exp, lineno);
514:•                if (found != null)
515:                 {
516:                         return found;
517:                 }
518:
519:                 return af.createPExpAssistant().findExpression(exp.getArgs(), lineno);
520:         }
521:
522:         @Override
523:         public PExp caseAPostOpExp(APostOpExp exp, Integer lineno)
524:                         throws AnalysisException
525:         {
526:
527:                 return exp.getPostexpression().apply(THIS, lineno);
528:         }
529:
530:         @Override
531:         public PExp caseASameBaseClassExp(ASameBaseClassExp exp, Integer lineno)
532:                         throws AnalysisException
533:         {
534:
535:                 PExp found = findExpressionBaseCase(exp, lineno);
536:•                if (found != null)
537:                 {
538:                         return found;
539:                 }
540:
541:                 found = exp.getLeft().apply(THIS, lineno);
542:•                if (found != null)
543:                 {
544:                         return found;
545:                 }
546:
547:                 found = exp.getRight().apply(THIS, lineno);
548:•                if (found != null)
549:                 {
550:                         return found;
551:                 }
552:
553:                 return null;
554:         }
555:
556:         @Override
557:         public PExp caseASameClassExp(ASameClassExp exp, Integer lineno)
558:                         throws AnalysisException
559:         {
560:
561:                 PExp found = findExpressionBaseCase(exp, lineno);
562:•                if (found != null)
563:                 {
564:                         return found;
565:                 }
566:
567:                 found = exp.getLeft().apply(THIS, lineno);
568:•                if (found != null)
569:                 {
570:                         return found;
571:                 }
572:
573:                 found = exp.getRight().apply(THIS, lineno);
574:•                if (found != null)
575:                 {
576:                         return found;
577:                 }
578:
579:                 return null;
580:         }
581:
582:         @Override
583:         public PExp caseASeqCompSeqExp(ASeqCompSeqExp exp, Integer lineno)
584:                         throws AnalysisException
585:         {
586:
587:                 PExp found = findExpressionBaseCase(exp, lineno);
588:•                if (found != null)
589:                 {
590:                         return found;
591:                 }
592:
593:                 found = exp.getFirst().apply(THIS, lineno);
594:•                if (found != null)
595:                 {
596:                         return found;
597:                 }
598:
599:•                return exp.getPredicate() == null ? null
600:                                 : exp.getPredicate().apply(THIS, lineno);
601:
602:         }
603:
604:         @Override
605:         public PExp caseASeqEnumSeqExp(ASeqEnumSeqExp exp, Integer lineno)
606:                         throws AnalysisException
607:         {
608:
609:                 PExp found = findExpressionBaseCase(exp, lineno);
610:•                if (found != null)
611:                 {
612:                         return found;
613:                 }
614:
615:                 return af.createPExpAssistant().findExpression(exp.getMembers(), lineno);
616:         }
617:
618:         @Override
619:         public PExp defaultSSeqExp(SSeqExp exp, Integer lineno)
620:                         throws AnalysisException
621:         {
622:
623:                 return null;
624:         }
625:
626:         @Override
627:         public PExp caseASetCompSetExp(ASetCompSetExp exp, Integer lineno)
628:                         throws AnalysisException
629:         {
630:
631:                 PExp found = findExpressionBaseCase(exp, lineno);
632:•                if (found != null)
633:                 {
634:                         return found;
635:                 }
636:
637:                 found = exp.getFirst().apply(THIS, lineno);
638:•                if (found != null)
639:                 {
640:                         return found;
641:                 }
642:
643:•                return exp.getPredicate() == null ? null
644:                                 : exp.getPredicate().apply(THIS, lineno);
645:         }
646:
647:         @Override
648:         public PExp caseASetEnumSetExp(ASetEnumSetExp exp, Integer lineno)
649:                         throws AnalysisException
650:         {
651:                 PExp found = findExpressionBaseCase(exp, lineno);
652:•                if (found != null)
653:                 {
654:                         return found;
655:                 }
656:
657:                 return af.createPExpAssistant().findExpression(exp.getMembers(), lineno);
658:
659:         }
660:
661:         @Override
662:         public PExp caseASetRangeSetExp(ASetRangeSetExp exp, Integer lineno)
663:                         throws AnalysisException
664:         {
665:
666:                 PExp found = findExpressionBaseCase(exp, lineno);
667:•                if (found != null)
668:                 {
669:                         return found;
670:                 }
671:
672:                 found = exp.getFirst().apply(THIS, lineno);
673:•                if (found != null)
674:                 {
675:                         return found;
676:                 }
677:
678:                 found = exp.getLast().apply(THIS, lineno);
679:•                if (found != null)
680:                 {
681:                         return found;
682:                 }
683:
684:                 return null;
685:         }
686:
687:         @Override
688:         public PExp defaultSSetExp(SSetExp exp, Integer lineno)
689:                         throws AnalysisException
690:         {
691:
692:                 return null;
693:         }
694:
695:         @Override
696:         public PExp caseASubseqExp(ASubseqExp exp, Integer lineno)
697:                         throws AnalysisException
698:         {
699:
700:                 PExp found = findExpressionBaseCase(exp, lineno);
701:•                if (found != null)
702:                 {
703:                         return found;
704:                 }
705:
706:                 found = exp.getSeq().apply(THIS, lineno);
707:•                if (found != null)
708:                 {
709:                         return found;
710:                 }
711:
712:                 found = exp.getFrom().apply(THIS, lineno);
713:•                if (found != null)
714:                 {
715:                         return found;
716:                 }
717:
718:                 found = exp.getTo().apply(THIS, lineno);
719:•                if (found != null)
720:                 {
721:                         return found;
722:                 }
723:
724:                 return null;
725:         }
726:
727:         @Override
728:         public PExp caseATupleExp(ATupleExp exp, Integer lineno)
729:                         throws AnalysisException
730:         {
731:
732:                 PExp found = findExpressionBaseCase(exp, lineno);
733:•                if (found != null)
734:                 {
735:                         return found;
736:                 }
737:
738:                 return af.createPExpAssistant().findExpression(exp.getArgs(), lineno);
739:         }
740:
741:         @Override
742:         public PExp defaultSUnaryExp(SUnaryExp exp, Integer lineno)
743:                         throws AnalysisException
744:         {
745:
746:                 PExp found = findExpressionBaseCase(exp, lineno);
747:•                if (found != null)
748:                 {
749:                         return found;
750:                 }
751:
752:                 return exp.getExp().apply(THIS, lineno);
753:         }
754:
755:         @Override
756:         public PExp defaultPExp(PExp exp, Integer lineno) throws AnalysisException
757:         {
758:                 return findExpressionBaseCase(exp, lineno);
759:         }
760:
761:         @Override
762:         public PExp createNewReturnValue(INode node, Integer question)
763:                         throws AnalysisException
764:         {
765:                 // TODO Auto-generated method stub
766:                 return null;
767:         }
768:
769:         @Override
770:         public PExp createNewReturnValue(Object node, Integer question)
771:                         throws AnalysisException
772:         {
773:                 // TODO Auto-generated method stub
774:                 return null;
775:         }
776:
777:         public static PExp findExpressionBaseCase(PExp exp, int lineno)
778:         {
779:•                return exp.getLocation().getStartLine() == lineno ? exp : null;
780:         }
781:
782: }