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:114 027 * @production AssignMinusExpr : {@link AssignAdditiveExpr}; 028 029 */ 030 public class AssignMinusExpr extends AssignAdditiveExpr implements Cloneable { 031 /** 032 * @aspect TypeCheck 033 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:113 034 */ 035 public void typeCheck() { 036 if (getSource().type().isBoolean() || getDest().type().isBoolean()) { 037 error("Operator - does not operate on boolean types"); 038 } 039 super.typeCheck(); 040 } 041 /** 042 * @aspect CreateBCode 043 * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:506 044 */ 045 public void createAssignOp(CodeGeneration gen, TypeDecl type) { type.sub(gen); } 046 /** 047 * @declaredat ASTNode:1 048 */ 049 public AssignMinusExpr() { 050 super(); 051 } 052 /** 053 * Initializes the child array to the correct size. 054 * Initializes List and Opt nta children. 055 * @apilevel internal 056 * @ast method 057 * @declaredat ASTNode:10 058 */ 059 public void init$Children() { 060 children = new ASTNode[2]; 061 } 062 /** 063 * @declaredat ASTNode:13 064 */ 065 public AssignMinusExpr(Expr p0, Expr p1) { 066 setChild(p0, 0); 067 setChild(p1, 1); 068 } 069 /** 070 * @apilevel low-level 071 * @declaredat ASTNode:20 072 */ 073 protected int numChildren() { 074 return 2; 075 } 076 /** 077 * @apilevel internal 078 * @declaredat ASTNode:26 079 */ 080 public boolean mayHaveRewrite() { 081 return false; 082 } 083 /** 084 * @apilevel internal 085 * @declaredat ASTNode:32 086 */ 087 public void flushAttrCache() { 088 super.flushAttrCache(); 089 } 090 /** 091 * @apilevel internal 092 * @declaredat ASTNode:38 093 */ 094 public void flushCollectionCache() { 095 super.flushCollectionCache(); 096 } 097 /** 098 * @apilevel internal 099 * @declaredat ASTNode:44 100 */ 101 public void flushRewriteCache() { 102 super.flushRewriteCache(); 103 } 104 /** 105 * @apilevel internal 106 * @declaredat ASTNode:50 107 */ 108 public AssignMinusExpr clone() throws CloneNotSupportedException { 109 AssignMinusExpr node = (AssignMinusExpr) super.clone(); 110 return node; 111 } 112 /** 113 * @apilevel internal 114 * @declaredat ASTNode:57 115 */ 116 public AssignMinusExpr copy() { 117 try { 118 AssignMinusExpr node = (AssignMinusExpr) clone(); 119 node.parent = null; 120 if (children != null) { 121 node.children = (ASTNode[]) children.clone(); 122 } 123 return node; 124 } catch (CloneNotSupportedException e) { 125 throw new Error("Error: clone not supported for " + getClass().getName()); 126 } 127 } 128 /** 129 * Create a deep copy of the AST subtree at this node. 130 * The copy is dangling, i.e. has no parent. 131 * @return dangling copy of the subtree at this node 132 * @apilevel low-level 133 * @deprecated Please use treeCopy or treeCopyNoTransform instead 134 * @declaredat ASTNode:76 135 */ 136 @Deprecated 137 public AssignMinusExpr fullCopy() { 138 return treeCopyNoTransform(); 139 } 140 /** 141 * Create a deep copy of the AST subtree at this node. 142 * The copy is dangling, i.e. has no parent. 143 * @return dangling copy of the subtree at this node 144 * @apilevel low-level 145 * @declaredat ASTNode:86 146 */ 147 public AssignMinusExpr treeCopyNoTransform() { 148 AssignMinusExpr tree = (AssignMinusExpr) copy(); 149 if (children != null) { 150 for (int i = 0; i < children.length; ++i) { 151 ASTNode child = (ASTNode) children[i]; 152 if (child != null) { 153 child = child.treeCopyNoTransform(); 154 tree.setChild(child, i); 155 } 156 } 157 } 158 return tree; 159 } 160 /** 161 * Create a deep copy of the AST subtree at this node. 162 * The subtree of this node is traversed to trigger rewrites before copy. 163 * The copy is dangling, i.e. has no parent. 164 * @return dangling copy of the subtree at this node 165 * @apilevel low-level 166 * @declaredat ASTNode:106 167 */ 168 public AssignMinusExpr treeCopy() { 169 doFullTraversal(); 170 return treeCopyNoTransform(); 171 } 172 /** 173 * @apilevel internal 174 * @declaredat ASTNode:113 175 */ 176 protected boolean is$Equal(ASTNode node) { 177 return super.is$Equal(node); 178 } 179 /** 180 * Replaces the Dest child. 181 * @param node The new node to replace the Dest child. 182 * @apilevel high-level 183 */ 184 public void setDest(Expr node) { 185 setChild(node, 0); 186 } 187 /** 188 * Retrieves the Dest child. 189 * @return The current node used as the Dest child. 190 * @apilevel high-level 191 */ 192 @ASTNodeAnnotation.Child(name="Dest") 193 public Expr getDest() { 194 return (Expr) getChild(0); 195 } 196 /** 197 * Retrieves the Dest child. 198 * <p><em>This method does not invoke AST transformations.</em></p> 199 * @return The current node used as the Dest child. 200 * @apilevel low-level 201 */ 202 public Expr getDestNoTransform() { 203 return (Expr) getChildNoTransform(0); 204 } 205 /** 206 * Replaces the Source child. 207 * @param node The new node to replace the Source child. 208 * @apilevel high-level 209 */ 210 public void setSource(Expr node) { 211 setChild(node, 1); 212 } 213 /** 214 * Retrieves the Source child. 215 * @return The current node used as the Source child. 216 * @apilevel high-level 217 */ 218 @ASTNodeAnnotation.Child(name="Source") 219 public Expr getSource() { 220 return (Expr) getChild(1); 221 } 222 /** 223 * Retrieves the Source child. 224 * <p><em>This method does not invoke AST transformations.</em></p> 225 * @return The current node used as the Source child. 226 * @apilevel low-level 227 */ 228 public Expr getSourceNoTransform() { 229 return (Expr) getChildNoTransform(1); 230 } 231 /** The operator string used for pretty printing this expression. 232 * @attribute syn 233 * @aspect PrettyPrintUtil 234 * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:292 235 */ 236 @ASTNodeAnnotation.Attribute 237 public String printOp() { 238 String printOp_value = "-="; 239 240 return printOp_value; 241 } 242 /** 243 * @apilevel internal 244 */ 245 public ASTNode rewriteTo() { 246 return super.rewriteTo(); 247 } 248 }