16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.tools.javac.jvm;
27
28 import java.util.*;
29
30 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
31 import com.sun.tools.javac.tree.*;
32 import com.sun.tools.javac.util.*;
33 import com.sun.tools.javac.util.List;
34 import com.sun.tools.javac.tree.JCTree.*;
35 import com.sun.tools.javac.tree.EndPosTable;
36
37 /** This class contains the CharacterRangeTable for some method
38 * and the hashtable for mapping trees or lists of trees to their
39 * ending positions.
40 *
41 * <p><b>This is NOT part of any supported API.
42 * If you write code that depends on this, you do so at your own risk.
43 * This code and its internal interfaces are subject to change or
44 * deletion without notice.</b>
45 */
46 public class CRTable
47 implements CRTFlags {
48
49 private final boolean crtDebug = false;
50
51 /** The list of CRTable entries.
52 */
53 private ListBuffer<CRTEntry> entries = new ListBuffer<>();
54
55 /** The hashtable for source positions.
288 sr.mergeWith(csp(tree.step));
289 sr.mergeWith(csp(tree.body));
290 result = sr;
291 }
292
293 public void visitForeachLoop(JCEnhancedForLoop tree) {
294 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
295 sr.mergeWith(csp(tree.var));
296 sr.mergeWith(csp(tree.expr));
297 sr.mergeWith(csp(tree.body));
298 result = sr;
299 }
300
301 public void visitLabelled(JCLabeledStatement tree) {
302 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
303 sr.mergeWith(csp(tree.body));
304 result = sr;
305 }
306
307 public void visitSwitch(JCSwitch tree) {
308 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
309 sr.mergeWith(csp(tree.selector));
310 sr.mergeWith(cspCases(tree.cases));
311 result = sr;
312 }
313
314 public void visitCase(JCCase tree) {
315 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
316 sr.mergeWith(csp(tree.pats));
317 sr.mergeWith(csp(tree.stats));
318 result = sr;
319 }
320
321 public void visitSynchronized(JCSynchronized tree) {
322 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
323 sr.mergeWith(csp(tree.lock));
324 sr.mergeWith(csp(tree.body));
325 result = sr;
326 }
327
|
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.tools.javac.jvm;
27
28 import java.util.*;
29
30 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
31 import com.sun.tools.javac.tree.*;
32 import com.sun.tools.javac.util.*;
33 import com.sun.tools.javac.util.List;
34 import com.sun.tools.javac.tree.JCTree.*;
35 import com.sun.tools.javac.tree.EndPosTable;
36 import com.sun.tools.javac.tree.JCTree.JCSwitchExpression;
37
38 /** This class contains the CharacterRangeTable for some method
39 * and the hashtable for mapping trees or lists of trees to their
40 * ending positions.
41 *
42 * <p><b>This is NOT part of any supported API.
43 * If you write code that depends on this, you do so at your own risk.
44 * This code and its internal interfaces are subject to change or
45 * deletion without notice.</b>
46 */
47 public class CRTable
48 implements CRTFlags {
49
50 private final boolean crtDebug = false;
51
52 /** The list of CRTable entries.
53 */
54 private ListBuffer<CRTEntry> entries = new ListBuffer<>();
55
56 /** The hashtable for source positions.
289 sr.mergeWith(csp(tree.step));
290 sr.mergeWith(csp(tree.body));
291 result = sr;
292 }
293
294 public void visitForeachLoop(JCEnhancedForLoop tree) {
295 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
296 sr.mergeWith(csp(tree.var));
297 sr.mergeWith(csp(tree.expr));
298 sr.mergeWith(csp(tree.body));
299 result = sr;
300 }
301
302 public void visitLabelled(JCLabeledStatement tree) {
303 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
304 sr.mergeWith(csp(tree.body));
305 result = sr;
306 }
307
308 public void visitSwitch(JCSwitch tree) {
309 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
310 sr.mergeWith(csp(tree.selector));
311 sr.mergeWith(cspCases(tree.cases));
312 result = sr;
313 }
314
315 @Override
316 public void visitSwitchExpression(JCSwitchExpression tree) {
317 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
318 sr.mergeWith(csp(tree.selector));
319 sr.mergeWith(cspCases(tree.cases));
320 result = sr;
321 }
322
323 public void visitCase(JCCase tree) {
324 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
325 sr.mergeWith(csp(tree.pats));
326 sr.mergeWith(csp(tree.stats));
327 result = sr;
328 }
329
330 public void visitSynchronized(JCSynchronized tree) {
331 SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
332 sr.mergeWith(csp(tree.lock));
333 sr.mergeWith(csp(tree.body));
334 result = sr;
335 }
336
|