001    /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */
002    package AST;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.*;
007    import beaver.*;
008    import java.util.ArrayList;
009    import java.util.zip.*;
010    import java.io.*;
011    import java.io.FileNotFoundException;
012    import java.util.Collection;
013    /**
014     * Java null literal.
015     * @production NullLiteral : {@link Literal};
016     * @ast node
017     * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/Literals.ast:42
018     */
019    public class NullLiteral extends Literal implements Cloneable {
020      /**
021       * @apilevel low-level
022       */
023      public void flushCache() {
024      }
025      /**
026       * @apilevel internal
027       */
028      public void flushCollectionCache() {
029      }
030      /**
031       * @apilevel internal
032       */
033      @SuppressWarnings({"unchecked", "cast"})
034      public NullLiteral clone() throws CloneNotSupportedException {
035        NullLiteral node = (NullLiteral)super.clone();
036        node.type_computed = false;
037        node.type_value = null;
038        node.in$Circle(false);
039        node.is$Final(false);
040        return node;
041      }
042    /**
043     * @apilevel internal
044     */
045      @SuppressWarnings({"unchecked", "cast"})
046    public NullLiteral copy() {
047      
048      try {
049        NullLiteral node = (NullLiteral) clone();
050        node.parent = null;
051        if(children != null)
052          node.children = (ASTNode[]) children.clone();
053        
054        return node;
055      } catch (CloneNotSupportedException e) {
056        throw new Error("Error: clone not supported for " + getClass().getName());
057      }
058      
059    }/**
060     * Create a deep copy of the AST subtree at this node.
061     * The copy is dangling, i.e. has no parent.
062     * @return dangling copy of the subtree at this node
063     * @apilevel low-level
064     */
065      @SuppressWarnings({"unchecked", "cast"})
066    public NullLiteral fullCopy() {
067      
068      NullLiteral tree = (NullLiteral) copy();
069      if (children != null) {
070        for (int i = 0; i < children.length; ++i) {
071          
072          ASTNode child = (ASTNode) children[i];
073          if(child != null) {
074            child = child.fullCopy();
075            tree.setChild(child, i);
076          }
077        }
078      }
079      return tree;
080      
081    }  /**
082       * @ast method 
083       * @aspect CodeGeneration
084       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:578
085       */
086      public void emitPushConstant(CodeGeneration gen) {
087        gen.emit(Bytecode.ACONST_NULL);
088      }
089      /**
090       * @ast method 
091       * 
092       */
093      public NullLiteral() {
094        super();
095    
096    
097      }
098      /**
099       * Initializes the child array to the correct size.
100       * Initializes List and Opt nta children.
101       * @apilevel internal
102       * @ast method
103       * @ast method 
104       * 
105       */
106      public void init$Children() {
107      }
108      /**
109       * @ast method 
110       * 
111       */
112      public NullLiteral(String p0) {
113        setLITERAL(p0);
114      }
115      /**
116       * @ast method 
117       * 
118       */
119      public NullLiteral(beaver.Symbol p0) {
120        setLITERAL(p0);
121      }
122      /**
123       * @apilevel low-level
124       * @ast method 
125       * 
126       */
127      protected int numChildren() {
128        return 0;
129      }
130      /**
131       * @apilevel internal
132       * @ast method 
133       * 
134       */
135      public boolean mayHaveRewrite() {
136        return false;
137      }
138      /**
139       * Replaces the lexeme LITERAL.
140       * @param value The new value for the lexeme LITERAL.
141       * @apilevel high-level
142       * @ast method 
143       * 
144       */
145      public void setLITERAL(String value) {
146        tokenString_LITERAL = value;
147      }
148      /**
149       * JastAdd-internal setter for lexeme LITERAL using the Beaver parser.
150       * @apilevel internal
151       * @ast method 
152       * 
153       */
154      public void setLITERAL(beaver.Symbol symbol) {
155        if(symbol.value != null && !(symbol.value instanceof String))
156          throw new UnsupportedOperationException("setLITERAL is only valid for String lexemes");
157        tokenString_LITERAL = (String)symbol.value;
158        LITERALstart = symbol.getStart();
159        LITERALend = symbol.getEnd();
160      }
161      /**
162       * Retrieves the value for the lexeme LITERAL.
163       * @return The value for the lexeme LITERAL.
164       * @apilevel high-level
165       * @ast method 
166       * 
167       */
168      public String getLITERAL() {
169        return tokenString_LITERAL != null ? tokenString_LITERAL : "";
170      }
171      /**
172       * @attribute syn
173       * @aspect ConstantExpression
174       * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:336
175       */
176      public boolean isConstant() {
177        ASTNode$State state = state();
178        try {  return false;  }
179        finally {
180        }
181      }
182      /**
183       * @apilevel internal
184       */
185      protected boolean type_computed = false;
186      /**
187       * @apilevel internal
188       */
189      protected TypeDecl type_value;
190      /**
191       * @attribute syn
192       * @aspect TypeAnalysis
193       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:307
194       */
195      @SuppressWarnings({"unchecked", "cast"})
196      public TypeDecl type() {
197        if(type_computed) {
198          return type_value;
199        }
200          ASTNode$State state = state();
201      int num = state.boundariesCrossed;
202      boolean isFinal = this.is$Final();
203        type_value = type_compute();
204      if(isFinal && num == state().boundariesCrossed){ type_computed = true; }
205            return type_value;
206      }
207      /**
208       * @apilevel internal
209       */
210      private TypeDecl type_compute() {  return typeNull();  }
211      /**
212       * @apilevel internal
213       */
214      public ASTNode rewriteTo() {
215        return super.rewriteTo();
216      }
217    }