< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java

Print this page

 634             case ERRONEOUS: {
 635                 JCErroneous node = (JCErroneous)tree;
 636                 if (node.errs != null && node.errs.nonEmpty()) {
 637                     int pos = getStartPos(node.errs.head);
 638                     if (pos != Position.NOPOS) {
 639                         return pos;
 640                     }
 641                 }
 642                 break;
 643             }
 644         }
 645         return tree.pos;
 646     }
 647 
 648     /** The end position of given tree, given  a table of end positions generated by the parser
 649      */
 650     public static int getEndPos(JCTree tree, EndPosTable endPosTable) {
 651         if (tree == null)
 652             return Position.NOPOS;
 653 





 654         int mapPos = endPosTable.getEndPos(tree);
 655         if (mapPos != Position.NOPOS)
 656             return mapPos;
 657 
 658         switch(tree.getTag()) {
 659             case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
 660             case SL_ASG: case SR_ASG: case USR_ASG:
 661             case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
 662             case DIV_ASG: case MOD_ASG:
 663             case OR: case AND: case BITOR:
 664             case BITXOR: case BITAND: case EQ:
 665             case NE: case LT: case GT:
 666             case LE: case GE: case SL:
 667             case SR: case USR: case PLUS:
 668             case MINUS: case MUL: case DIV:
 669             case MOD:
 670             case POS:
 671             case NEG:
 672             case NOT:
 673             case COMPL:

 634             case ERRONEOUS: {
 635                 JCErroneous node = (JCErroneous)tree;
 636                 if (node.errs != null && node.errs.nonEmpty()) {
 637                     int pos = getStartPos(node.errs.head);
 638                     if (pos != Position.NOPOS) {
 639                         return pos;
 640                     }
 641                 }
 642                 break;
 643             }
 644         }
 645         return tree.pos;
 646     }
 647 
 648     /** The end position of given tree, given  a table of end positions generated by the parser
 649      */
 650     public static int getEndPos(JCTree tree, EndPosTable endPosTable) {
 651         if (tree == null)
 652             return Position.NOPOS;
 653 
 654         if (endPosTable == null) {
 655             // fall back on limited info in the tree
 656             return endPos(tree);
 657         }
 658 
 659         int mapPos = endPosTable.getEndPos(tree);
 660         if (mapPos != Position.NOPOS)
 661             return mapPos;
 662 
 663         switch(tree.getTag()) {
 664             case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
 665             case SL_ASG: case SR_ASG: case USR_ASG:
 666             case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
 667             case DIV_ASG: case MOD_ASG:
 668             case OR: case AND: case BITOR:
 669             case BITXOR: case BITAND: case EQ:
 670             case NE: case LT: case GT:
 671             case LE: case GE: case SL:
 672             case SR: case USR: case PLUS:
 673             case MINUS: case MUL: case DIV:
 674             case MOD:
 675             case POS:
 676             case NEG:
 677             case NOT:
 678             case COMPL:
< prev index next >