001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */
002    package org.extendj.ast;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.Set;
007    import java.util.Collections;
008    import java.util.Collection;
009    import java.util.ArrayList;
010    import beaver.*;
011    import java.util.*;
012    import java.io.ByteArrayOutputStream;
013    import java.io.PrintStream;
014    import java.lang.reflect.InvocationTargetException;
015    import java.lang.reflect.Method;
016    import org.jastadd.util.*;
017    import java.util.zip.*;
018    import java.io.*;
019    import org.jastadd.util.PrettyPrintable;
020    import org.jastadd.util.PrettyPrinter;
021    import java.io.FileNotFoundException;
022    import java.io.BufferedInputStream;
023    import java.io.DataInputStream;
024    /**
025     * @ast node
026     * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:144
027     * @production PostIncExpr : {@link PostfixExpr};
028    
029     */
030    public class PostIncExpr extends PostfixExpr implements Cloneable {
031      /**
032       * @aspect CreateBCode
033       * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:943
034       */
035      public void createBCode(CodeGeneration gen) { emitPostfix(gen, 1); }
036      /**
037       * @declaredat ASTNode:1
038       */
039      public PostIncExpr() {
040        super();
041      }
042      /**
043       * Initializes the child array to the correct size.
044       * Initializes List and Opt nta children.
045       * @apilevel internal
046       * @ast method
047       * @declaredat ASTNode:10
048       */
049      public void init$Children() {
050        children = new ASTNode[1];
051      }
052      /**
053       * @declaredat ASTNode:13
054       */
055      public PostIncExpr(Expr p0) {
056        setChild(p0, 0);
057      }
058      /**
059       * @apilevel low-level
060       * @declaredat ASTNode:19
061       */
062      protected int numChildren() {
063        return 1;
064      }
065      /**
066       * @apilevel internal
067       * @declaredat ASTNode:25
068       */
069      public boolean mayHaveRewrite() {
070        return false;
071      }
072      /**
073       * @apilevel internal
074       * @declaredat ASTNode:31
075       */
076      public void flushAttrCache() {
077        super.flushAttrCache();
078        stmtCompatible_reset();
079      }
080      /**
081       * @apilevel internal
082       * @declaredat ASTNode:38
083       */
084      public void flushCollectionCache() {
085        super.flushCollectionCache();
086      }
087      /**
088       * @apilevel internal
089       * @declaredat ASTNode:44
090       */
091      public void flushRewriteCache() {
092        super.flushRewriteCache();
093      }
094      /**
095       * @apilevel internal
096       * @declaredat ASTNode:50
097       */
098      public PostIncExpr clone() throws CloneNotSupportedException {
099        PostIncExpr node = (PostIncExpr) super.clone();
100        return node;
101      }
102      /**
103       * @apilevel internal
104       * @declaredat ASTNode:57
105       */
106      public PostIncExpr copy() {
107        try {
108          PostIncExpr node = (PostIncExpr) clone();
109          node.parent = null;
110          if (children != null) {
111            node.children = (ASTNode[]) children.clone();
112          }
113          return node;
114        } catch (CloneNotSupportedException e) {
115          throw new Error("Error: clone not supported for " + getClass().getName());
116        }
117      }
118      /**
119       * Create a deep copy of the AST subtree at this node.
120       * The copy is dangling, i.e. has no parent.
121       * @return dangling copy of the subtree at this node
122       * @apilevel low-level
123       * @deprecated Please use treeCopy or treeCopyNoTransform instead
124       * @declaredat ASTNode:76
125       */
126      @Deprecated
127      public PostIncExpr fullCopy() {
128        return treeCopyNoTransform();
129      }
130      /**
131       * Create a deep copy of the AST subtree at this node.
132       * The copy is dangling, i.e. has no parent.
133       * @return dangling copy of the subtree at this node
134       * @apilevel low-level
135       * @declaredat ASTNode:86
136       */
137      public PostIncExpr treeCopyNoTransform() {
138        PostIncExpr tree = (PostIncExpr) copy();
139        if (children != null) {
140          for (int i = 0; i < children.length; ++i) {
141            ASTNode child = (ASTNode) children[i];
142            if (child != null) {
143              child = child.treeCopyNoTransform();
144              tree.setChild(child, i);
145            }
146          }
147        }
148        return tree;
149      }
150      /**
151       * Create a deep copy of the AST subtree at this node.
152       * The subtree of this node is traversed to trigger rewrites before copy.
153       * The copy is dangling, i.e. has no parent.
154       * @return dangling copy of the subtree at this node
155       * @apilevel low-level
156       * @declaredat ASTNode:106
157       */
158      public PostIncExpr treeCopy() {
159        doFullTraversal();
160        return treeCopyNoTransform();
161      }
162      /**
163       * @apilevel internal
164       * @declaredat ASTNode:113
165       */
166      protected boolean is$Equal(ASTNode node) {
167        return super.is$Equal(node);    
168      }
169      /**
170       * Replaces the Operand child.
171       * @param node The new node to replace the Operand child.
172       * @apilevel high-level
173       */
174      public void setOperand(Expr node) {
175        setChild(node, 0);
176      }
177      /**
178       * Retrieves the Operand child.
179       * @return The current node used as the Operand child.
180       * @apilevel high-level
181       */
182      @ASTNodeAnnotation.Child(name="Operand")
183      public Expr getOperand() {
184        return (Expr) getChild(0);
185      }
186      /**
187       * Retrieves the Operand child.
188       * <p><em>This method does not invoke AST transformations.</em></p>
189       * @return The current node used as the Operand child.
190       * @apilevel low-level
191       */
192      public Expr getOperandNoTransform() {
193        return (Expr) getChildNoTransform(0);
194      }
195      /**
196       * @attribute syn
197       * @aspect PrettyPrintUtil
198       * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:306
199       */
200      @ASTNodeAnnotation.Attribute
201      public String printPostOp() {
202        String printPostOp_value = "++";
203    
204        return printPostOp_value;
205      }
206      /**
207       * @attribute syn
208       * @aspect CreateBCode
209       * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:251
210       */
211      @ASTNodeAnnotation.Attribute
212      public boolean needsPop() {
213        boolean needsPop_value = getOperand().isVarAccessWithAccessor();
214    
215        return needsPop_value;
216      }
217      /**
218       * @attribute syn
219       * @aspect PreciseRethrow
220       * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:149
221       */
222      @ASTNodeAnnotation.Attribute
223      public boolean modifiedInScope(Variable var) {
224        boolean modifiedInScope_Variable_value = getOperand().isVariable(var);
225    
226        return modifiedInScope_Variable_value;
227      }
228      /**
229       * @apilevel internal
230       */
231      protected boolean stmtCompatible_computed = false;
232      /**
233       * @apilevel internal
234       */
235      protected boolean stmtCompatible_value;
236      /**
237       * @apilevel internal
238       */
239      private void stmtCompatible_reset() {
240        stmtCompatible_computed = false;
241      }
242      /**
243       * @attribute syn
244       * @aspect StmtCompatible
245       * @declaredat /home/jesper/git/extendj/java8/frontend/LambdaExpr.jrag:141
246       */
247      @ASTNodeAnnotation.Attribute
248      public boolean stmtCompatible() {
249        ASTNode$State state = state();
250        if (stmtCompatible_computed) {
251          return stmtCompatible_value;
252        }
253        boolean intermediate = state.INTERMEDIATE_VALUE;
254        state.INTERMEDIATE_VALUE = false;
255        int num = state.boundariesCrossed;
256        boolean isFinal = this.is$Final();
257        stmtCompatible_value = true;
258        if (isFinal && num == state().boundariesCrossed) {
259          stmtCompatible_computed = true;
260        } else {
261        }
262        state.INTERMEDIATE_VALUE |= intermediate;
263    
264        return stmtCompatible_value;
265      }
266      /**
267       * @apilevel internal
268       */
269      public ASTNode rewriteTo() {
270        return super.rewriteTo();
271      }
272    }