515 public void visitErroneous(JCErroneous tree) {
516 result = null;
517 }
518
519 public void visitTree(JCTree tree) {
520 Assert.error();
521 }
522
523 /** The start position of given tree.
524 */
525 public int startPos(JCTree tree) {
526 if (tree == null) return Position.NOPOS;
527 return tree.pos;
528 }
529
530 /** The end position of given tree, if it has
531 * defined endpos, NOPOS otherwise.
532 */
533 public int endPos(JCTree tree) {
534 if (tree == null) return Position.NOPOS;
535 if (tree.getTag() == JCTree.BLOCK)
536 return ((JCBlock) tree).endpos;
537 Integer endpos = endPositions.get(tree);
538 if (endpos != null)
539 return endpos.intValue();
540 return Position.NOPOS;
541 }
542 }
543
544 /** This class contains a CharacterRangeTableEntry.
545 */
546 static class CRTEntry {
547
548 /** A tree or a list of trees to obtain source positions.
549 */
550 Object tree;
551
552 /** The flags described in the CharacterRangeTable spec.
553 */
554 int flags;
555
|
515 public void visitErroneous(JCErroneous tree) {
516 result = null;
517 }
518
519 public void visitTree(JCTree tree) {
520 Assert.error();
521 }
522
523 /** The start position of given tree.
524 */
525 public int startPos(JCTree tree) {
526 if (tree == null) return Position.NOPOS;
527 return tree.pos;
528 }
529
530 /** The end position of given tree, if it has
531 * defined endpos, NOPOS otherwise.
532 */
533 public int endPos(JCTree tree) {
534 if (tree == null) return Position.NOPOS;
535 if (tree.hasTag(JCTree.Tag.BLOCK))
536 return ((JCBlock) tree).endpos;
537 Integer endpos = endPositions.get(tree);
538 if (endpos != null)
539 return endpos.intValue();
540 return Position.NOPOS;
541 }
542 }
543
544 /** This class contains a CharacterRangeTableEntry.
545 */
546 static class CRTEntry {
547
548 /** A tree or a list of trees to obtain source positions.
549 */
550 Object tree;
551
552 /** The flags described in the CharacterRangeTable spec.
553 */
554 int flags;
555
|