equal
deleted
inserted
replaced
404 public static int getStartPos(JCTree tree) { |
404 public static int getStartPos(JCTree tree) { |
405 if (tree == null) |
405 if (tree == null) |
406 return Position.NOPOS; |
406 return Position.NOPOS; |
407 |
407 |
408 switch(tree.getTag()) { |
408 switch(tree.getTag()) { |
|
409 case PACKAGEDEF: { |
|
410 JCPackageDecl pd = (JCPackageDecl)tree; |
|
411 return pd.annotations.isEmpty() ? pd.pos : |
|
412 pd.annotations.head.pos; |
|
413 } |
409 case APPLY: |
414 case APPLY: |
410 return getStartPos(((JCMethodInvocation) tree).meth); |
415 return getStartPos(((JCMethodInvocation) tree).meth); |
411 case ASSIGN: |
416 case ASSIGN: |
412 return getStartPos(((JCAssign) tree).lhs); |
417 return getStartPos(((JCAssign) tree).lhs); |
413 case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: |
418 case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: |
786 private static Symbol symbolForImpl(JCTree node) { |
791 private static Symbol symbolForImpl(JCTree node) { |
787 node = skipParens(node); |
792 node = skipParens(node); |
788 switch (node.getTag()) { |
793 switch (node.getTag()) { |
789 case TOPLEVEL: |
794 case TOPLEVEL: |
790 return ((JCCompilationUnit) node).packge; |
795 return ((JCCompilationUnit) node).packge; |
|
796 case PACKAGEDEF: |
|
797 return ((JCPackageDecl) node).packge; |
791 case CLASSDEF: |
798 case CLASSDEF: |
792 return ((JCClassDecl) node).sym; |
799 return ((JCClassDecl) node).sym; |
793 case METHODDEF: |
800 case METHODDEF: |
794 return ((JCMethodDecl) node).sym; |
801 return ((JCMethodDecl) node).sym; |
795 case VARDEF: |
802 case VARDEF: |
818 } |
825 } |
819 |
826 |
820 public static boolean isDeclaration(JCTree node) { |
827 public static boolean isDeclaration(JCTree node) { |
821 node = skipParens(node); |
828 node = skipParens(node); |
822 switch (node.getTag()) { |
829 switch (node.getTag()) { |
|
830 case PACKAGEDEF: |
823 case CLASSDEF: |
831 case CLASSDEF: |
824 case METHODDEF: |
832 case METHODDEF: |
825 case VARDEF: |
833 case VARDEF: |
826 return true; |
834 return true; |
827 default: |
835 default: |