632 return ((JCMethodDecl) node).sym; |
632 return ((JCMethodDecl) node).sym; |
633 case JCTree.VARDEF: |
633 case JCTree.VARDEF: |
634 return ((JCVariableDecl) node).sym; |
634 return ((JCVariableDecl) node).sym; |
635 default: |
635 default: |
636 return null; |
636 return null; |
|
637 } |
|
638 } |
|
639 |
|
640 public static boolean isDeclaration(JCTree node) { |
|
641 node = skipParens(node); |
|
642 switch (node.getTag()) { |
|
643 case JCTree.CLASSDEF: |
|
644 case JCTree.METHODDEF: |
|
645 case JCTree.VARDEF: |
|
646 return true; |
|
647 default: |
|
648 return false; |
637 } |
649 } |
638 } |
650 } |
639 |
651 |
640 /** If this tree is an identifier or a field, return its symbol, |
652 /** If this tree is an identifier or a field, return its symbol, |
641 * otherwise return null. |
653 * otherwise return null. |