src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java

Print this page




 166      * @param printType print type?
 167      */
 168     public abstract void toString(final StringBuilder sb, final boolean printType);
 169 
 170     /**
 171      * Get the finish position for this node in the source string
 172      * @return finish
 173      */
 174     public int getFinish() {
 175         return finish;
 176     }
 177 
 178     /**
 179      * Get start position for node
 180      * @return start position
 181      */
 182     public int getStart() {
 183         return start;
 184     }
 185 











 186     @Override
 187     protected Object clone() {
 188         try {
 189             return super.clone();
 190         } catch (final CloneNotSupportedException e) {
 191             throw new AssertionError(e);
 192         }
 193     }
 194 
 195     @Override
 196     public final boolean equals(final Object other) {
 197         return this == other;
 198     }
 199 
 200     @Override
 201     public final int hashCode() {
 202         // NOTE: we aren't delegating to Object.hashCode as it still requires trip to the VM for initializing,
 203         // it touches the object header and/or stores the identity hashcode somewhere, etc. There's several
 204         // places in the compiler pipeline that store nodes in maps, so this can get hot.
 205         return Long.hashCode(token);




 166      * @param printType print type?
 167      */
 168     public abstract void toString(final StringBuilder sb, final boolean printType);
 169 
 170     /**
 171      * Get the finish position for this node in the source string
 172      * @return finish
 173      */
 174     public int getFinish() {
 175         return finish;
 176     }
 177 
 178     /**
 179      * Get start position for node
 180      * @return start position
 181      */
 182     public int getStart() {
 183         return start;
 184     }
 185 
 186     /**
 187      * Integer to sort nodes in source order. This order is
 188      * used by parser API to sort statements in correct order.
 189      * By default, this is the start position of this node.
 190      *
 191      * @return int code to sort this node.
 192      */
 193     public int getSourceOrder() {
 194         return getStart();
 195     }
 196 
 197     @Override
 198     protected Object clone() {
 199         try {
 200             return super.clone();
 201         } catch (final CloneNotSupportedException e) {
 202             throw new AssertionError(e);
 203         }
 204     }
 205 
 206     @Override
 207     public final boolean equals(final Object other) {
 208         return this == other;
 209     }
 210 
 211     @Override
 212     public final int hashCode() {
 213         // NOTE: we aren't delegating to Object.hashCode as it still requires trip to the VM for initializing,
 214         // it touches the object header and/or stores the identity hashcode somewhere, etc. There's several
 215         // places in the compiler pipeline that store nodes in maps, so this can get hot.
 216         return Long.hashCode(token);