124 } 125 126 /** 127 * For reference copies - ensure that labels in the copy node are unique 128 * using an appropriate copy constructor 129 * @param lc lexical context 130 * @return new node or same of no labels 131 */ 132 public Node ensureUniqueLabels(final LexicalContext lc) { 133 return this; 134 } 135 136 /** 137 * Provides a means to navigate the IR. 138 * @param visitor Node visitor. 139 * @return node the node or its replacement after visitation, null if no further visitations are required 140 */ 141 public abstract Node accept(NodeVisitor<? extends LexicalContext> visitor); 142 143 @Override 144 public String toString() { 145 final StringBuilder sb = new StringBuilder(); 146 toString(sb); 147 return sb.toString(); 148 } 149 150 /** 151 * String conversion helper. Fills a {@link StringBuilder} with the 152 * string version of this node 153 * 154 * @param sb a StringBuilder 155 */ 156 public void toString(final StringBuilder sb) { 157 toString(sb, true); 158 } 159 160 /** 161 * Print logic that decides whether to show the optimistic type 162 * or not - for example it should not be printed after just parse, 163 * when it hasn't been computed, or has been set to a trivially provable 164 * value 165 * @param sb string builder 166 * @param printType print type? | 124 } 125 126 /** 127 * For reference copies - ensure that labels in the copy node are unique 128 * using an appropriate copy constructor 129 * @param lc lexical context 130 * @return new node or same of no labels 131 */ 132 public Node ensureUniqueLabels(final LexicalContext lc) { 133 return this; 134 } 135 136 /** 137 * Provides a means to navigate the IR. 138 * @param visitor Node visitor. 139 * @return node the node or its replacement after visitation, null if no further visitations are required 140 */ 141 public abstract Node accept(NodeVisitor<? extends LexicalContext> visitor); 142 143 @Override 144 public final String toString() { 145 return toString(true); 146 } 147 148 /* 149 * Return String representation of this Node. 150 * @param includeTypeInfo include type information or not 151 */ 152 public final String toString(final boolean includeTypeInfo) { 153 final StringBuilder sb = new StringBuilder(); 154 toString(sb, includeTypeInfo); 155 return sb.toString(); 156 } 157 158 /** 159 * String conversion helper. Fills a {@link StringBuilder} with the 160 * string version of this node 161 * 162 * @param sb a StringBuilder 163 */ 164 public void toString(final StringBuilder sb) { 165 toString(sb, true); 166 } 167 168 /** 169 * Print logic that decides whether to show the optimistic type 170 * or not - for example it should not be printed after just parse, 171 * when it hasn't been computed, or has been set to a trivially provable 172 * value 173 * @param sb string builder 174 * @param printType print type? |