src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
changeset 59285 7799a51dbe30
parent 52635 6938c8ef179a
equal deleted inserted replaced
59284:88502b1cf76f 59285:7799a51dbe30
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   487                     //simply return node position
   487                     //simply return node position
   488                     return node.pos;
   488                     return node.pos;
   489                 } else {
   489                 } else {
   490                     return getStartPos(node.vartype);
   490                     return getStartPos(node.vartype);
   491                 }
   491                 }
       
   492             }
       
   493             case BINDINGPATTERN: {
       
   494                 JCBindingPattern node = (JCBindingPattern)tree;
       
   495                 return getStartPos(node.vartype);
   492             }
   496             }
   493             case ERRONEOUS: {
   497             case ERRONEOUS: {
   494                 JCErroneous node = (JCErroneous)tree;
   498                 JCErroneous node = (JCErroneous)tree;
   495                 if (node.errs != null && node.errs.nonEmpty())
   499                 if (node.errs != null && node.errs.nonEmpty())
   496                     return getStartPos(node.errs.head);
   500                     return getStartPos(node.errs.head);
   572             case WILDCARD:
   576             case WILDCARD:
   573                 return getEndPos(((JCWildcard) tree).inner, endPosTable);
   577                 return getEndPos(((JCWildcard) tree).inner, endPosTable);
   574             case TYPECAST:
   578             case TYPECAST:
   575                 return getEndPos(((JCTypeCast) tree).expr, endPosTable);
   579                 return getEndPos(((JCTypeCast) tree).expr, endPosTable);
   576             case TYPETEST:
   580             case TYPETEST:
   577                 return getEndPos(((JCInstanceOf) tree).clazz, endPosTable);
   581                 return getEndPos(((JCInstanceOf) tree).pattern, endPosTable);
   578             case WHILELOOP:
   582             case WHILELOOP:
   579                 return getEndPos(((JCWhileLoop) tree).body, endPosTable);
   583                 return getEndPos(((JCWhileLoop) tree).body, endPosTable);
   580             case ANNOTATED_TYPE:
   584             case ANNOTATED_TYPE:
   581                 return getEndPos(((JCAnnotatedType) tree).underlyingType, endPosTable);
   585                 return getEndPos(((JCAnnotatedType) tree).underlyingType, endPosTable);
   582             case ERRONEOUS: {
   586             case ERRONEOUS: {
   845         case TYPE_ANNOTATION:
   849         case TYPE_ANNOTATION:
   846         case TYPEPARAMETER:
   850         case TYPEPARAMETER:
   847             if (node.type != null)
   851             if (node.type != null)
   848                 return node.type.tsym;
   852                 return node.type.tsym;
   849             return null;
   853             return null;
       
   854         case BINDINGPATTERN:
       
   855             return ((JCBindingPattern) node).symbol;
   850         default:
   856         default:
   851             return null;
   857             return null;
   852         }
   858         }
   853     }
   859     }
   854 
   860 
  1223     }
  1229     }
  1224 
  1230 
  1225     public static boolean isPackageInfo(JCCompilationUnit tree) {
  1231     public static boolean isPackageInfo(JCCompilationUnit tree) {
  1226         return tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
  1232         return tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
  1227     }
  1233     }
       
  1234 
  1228 }
  1235 }