src/share/classes/com/sun/tools/javac/jvm/CRTable.java

changeset 1138
7375d4979bd3
parent 1127
ca49d50318dc
child 1280
5c0b3faeb0b0
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Mon Nov 14 08:09:47 2011 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Mon Nov 14 15:11:10 2011 -0800
     1.3 @@ -31,6 +31,7 @@
     1.4  import com.sun.tools.javac.util.*;
     1.5  import com.sun.tools.javac.util.List;
     1.6  import com.sun.tools.javac.tree.JCTree.*;
     1.7 +import com.sun.tools.javac.parser.EndPosTable;
     1.8  
     1.9  /** This class contains the CharacterRangeTable for some method
    1.10   *  and the hashtable for mapping trees or lists of trees to their
    1.11 @@ -54,9 +55,9 @@
    1.12       */
    1.13      private Map<Object,SourceRange> positions = new HashMap<Object,SourceRange>();
    1.14  
    1.15 -    /** The hashtable for ending positions stored in the parser.
    1.16 +    /** The object for ending positions stored in the parser.
    1.17       */
    1.18 -    private Map<JCTree, Integer> endPositions;
    1.19 +    private EndPosTable endPosTable;
    1.20  
    1.21      /** The tree of the method this table is intended for.
    1.22       *  We should traverse this tree to get source ranges.
    1.23 @@ -65,9 +66,9 @@
    1.24  
    1.25      /** Constructor
    1.26       */
    1.27 -    public CRTable(JCTree.JCMethodDecl tree, Map<JCTree, Integer> endPositions) {
    1.28 +    public CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable) {
    1.29          this.methodTree = tree;
    1.30 -        this.endPositions = endPositions;
    1.31 +        this.endPosTable = endPosTable;
    1.32      }
    1.33  
    1.34      /** Create a new CRTEntry and add it to the entries.
    1.35 @@ -534,10 +535,7 @@
    1.36              if (tree == null) return Position.NOPOS;
    1.37              if (tree.hasTag(JCTree.Tag.BLOCK))
    1.38                  return ((JCBlock) tree).endpos;
    1.39 -            Integer endpos = endPositions.get(tree);
    1.40 -            if (endpos != null)
    1.41 -                return endpos.intValue();
    1.42 -            return Position.NOPOS;
    1.43 +            return endPosTable.getEndPos(tree);
    1.44          }
    1.45      }
    1.46  

mercurial