01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: package de.uka.ilkd.key.rule.metaconstruct;
12:
13: import de.uka.ilkd.key.java.Expression;
14: import de.uka.ilkd.key.java.ProgramElement;
15: import de.uka.ilkd.key.java.Services;
16: import de.uka.ilkd.key.java.expression.literal.BooleanLiteral;
17: import de.uka.ilkd.key.java.recoderext.ImplicitFieldAdder;
18: import de.uka.ilkd.key.logic.op.ProgramVariable;
19: import de.uka.ilkd.key.logic.op.SchemaVariable;
20: import de.uka.ilkd.key.rule.inst.SVInstantiations;
21:
22: /**
23: * creates an assignment instantiationOf(#newObjectsV).<initialized> = true
24: */
25: public class PostWork extends ProgramMetaConstruct {
26:
27: /** creates a typeof ProgramMetaConstruct
28: * @param expr the instance of expression contained by
29: * the meta construct
30: */
31: public PostWork(SchemaVariable newObjectSV) {
32: super ("post-work", (Expression) newObjectSV);
33: }
34:
35: /**
36: * performs the program transformation needed for symbolic
37: * program transformation
38: * @return the transformated program
39: */
40: public ProgramElement symbolicExecution(ProgramElement pe,
41: Services services, SVInstantiations svInst) {
42: final ProgramVariable newObject = (ProgramVariable) svInst
43: .getInstantiation((SchemaVariable) body());
44:
45: final ProgramVariable initialized = services.getJavaInfo()
46: .getAttribute(ImplicitFieldAdder.IMPLICIT_INITIALIZED,
47: services.getJavaInfo().getJavaLangObject());
48: return assign(attribute(newObject, initialized),
49: BooleanLiteral.TRUE);
50: }
51: }
|