< prev index next >

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

Print this page

 150             }
 151         }
 152         return null;
 153     }
 154 
 155     /** Is this tree a 'this' identifier?
 156      */
 157     public static boolean isThisQualifier(JCTree tree) {
 158         switch (tree.getTag()) {
 159             case PARENS:
 160                 return isThisQualifier(skipParens(tree));
 161             case IDENT: {
 162                 JCIdent id = (JCIdent)tree;
 163                 return id.name == id.name.table.names._this;
 164             }
 165             default:
 166                 return false;
 167         }
 168     }
 169 













 170     /** Is this tree an identifier, possibly qualified by 'this'?
 171      */
 172     public static boolean isIdentOrThisDotIdent(JCTree tree) {
 173         switch (tree.getTag()) {
 174             case PARENS:
 175                 return isIdentOrThisDotIdent(skipParens(tree));
 176             case IDENT:
 177                 return true;
 178             case SELECT:
 179                 return isThisQualifier(((JCFieldAccess)tree).selected);
 180             default:
 181                 return false;
 182         }
 183     }
 184 
 185     /** Check if the given tree is an explicit reference to the 'this' instance of the
 186      *  class currently being compiled. This is true if tree is:
 187      *  - An unqualified 'this' identifier
 188      *  - A 'super' identifier qualified by a class name whose type is 'currentClass' or a supertype
 189      *  - A 'this' identifier qualified by a class name whose type is 'currentClass' or a supertype

 150             }
 151         }
 152         return null;
 153     }
 154 
 155     /** Is this tree a 'this' identifier?
 156      */
 157     public static boolean isThisQualifier(JCTree tree) {
 158         switch (tree.getTag()) {
 159             case PARENS:
 160                 return isThisQualifier(skipParens(tree));
 161             case IDENT: {
 162                 JCIdent id = (JCIdent)tree;
 163                 return id.name == id.name.table.names._this;
 164             }
 165             default:
 166                 return false;
 167         }
 168     }
 169 
 170     public static boolean isSuperQualifier(JCTree tree) {
 171         switch (tree.getTag()) {
 172             case PARENS:
 173                 return isThisQualifier(skipParens(tree));
 174             case IDENT: {
 175                 JCIdent id = (JCIdent)tree;
 176                 return id.name == id.name.table.names._super;
 177             }
 178             default:
 179                 return false;
 180         }
 181     }
 182 
 183     /** Is this tree an identifier, possibly qualified by 'this'?
 184      */
 185     public static boolean isIdentOrThisDotIdent(JCTree tree) {
 186         switch (tree.getTag()) {
 187             case PARENS:
 188                 return isIdentOrThisDotIdent(skipParens(tree));
 189             case IDENT:
 190                 return true;
 191             case SELECT:
 192                 return isThisQualifier(((JCFieldAccess)tree).selected);
 193             default:
 194                 return false;
 195         }
 196     }
 197 
 198     /** Check if the given tree is an explicit reference to the 'this' instance of the
 199      *  class currently being compiled. This is true if tree is:
 200      *  - An unqualified 'this' identifier
 201      *  - A 'super' identifier qualified by a class name whose type is 'currentClass' or a supertype
 202      *  - A 'this' identifier qualified by a class name whose type is 'currentClass' or a supertype
< prev index next >