Home | History | Annotate | Download | only in scanner

Lines Matching refs:path

27      * This is a path to a method or a field/instance/static initializer.
29 public static TreePath findCountingContext(TreePath path) {
30 while (path != null) {
31 if (path.getLeaf().getKind() == Tree.Kind.METHOD ||
32 isFieldInit(path) ||
33 isInitBlock(path)) {
34 return path;
36 path = path.getParentPath();
38 return path;
43 public static TreePath findEnclosingClass(TreePath path) {
44 while (!hasClassKind(path.getLeaf())
45 || path.getParentPath().getLeaf().getKind() ==
47 path = path.getParentPath();
48 if (path == null) {
52 return path;
57 public static TreePath findEnclosingMethod(TreePath path) {
58 while (path.getLeaf().getKind() != Tree.Kind.METHOD) {
59 path = path.getParentPath();
60 if (path == null) {
64 return path;
69 public static boolean isFieldInit(TreePath path) {
70 return path.getLeaf().getKind() == Tree.Kind.VARIABLE
71 && path.getParentPath() != null
72 && hasClassKind(path.getParentPath().getLeaf());
75 public static TreePath findEnclosingFieldInit(TreePath path) {
76 while (!isFieldInit(path)) {
77 path = path.getParentPath();
78 if (path == null) {
82 return path;
87 public static boolean isInitBlock(TreePath path, boolean isStatic) {
88 return isInitBlock(path)
89 && ((BlockTree) path.getLeaf()).isStatic() == isStatic;
92 public static boolean isInitBlock(TreePath path) {
93 return path.getParentPath() != null
94 && hasClassKind(path.getParentPath().getLeaf())
95 && path.getLeaf().getKind() == Tree.Kind.BLOCK;
98 public static TreePath findEnclosingInitBlock(TreePath path,
100 while (!isInitBlock(path, isStatic)) {
101 path = path.getParentPath();
102 if (path == null) {
106 return path;
109 public static boolean isStaticInit(TreePath path) {
110 return isInitBlock(path, true);
113 public static TreePath findEnclosingStaticInit(TreePath path) {
114 while (!isStaticInit(path)) {
115 path = path.getParentPath();
116 if (path == null) {
120 return path;
123 public static boolean isInstanceInit(TreePath path) {
124 return isInitBlock(path, false);
127 public static TreePath findEnclosingInstanceInit(TreePath path) {
128 while (!isInstanceInit(path)) {
129 path = path.getParentPath();
130 if (path == null) {
134 return path;