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