< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
Print this page
if (isConstructor(l.head)) return true;
return false;
}
/** Is there a constructor invocation in the given list of trees?
*/
! public static Name getConstructorInvocationName(List<? extends JCTree> trees, Names names) {
for (JCTree tree : trees) {
if (tree.hasTag(EXEC)) {
JCExpressionStatement stat = (JCExpressionStatement)tree;
if (stat.expr.hasTag(APPLY)) {
JCMethodInvocation apply = (JCMethodInvocation)stat.expr;
! Name methName = TreeInfo.name(apply.meth);
! if (methName == names._this ||
! methName == names._super) {
! return methName;
}
}
}
}
return names.empty;
if (isConstructor(l.head)) return true;
return false;
}
/** Is there a constructor invocation in the given list of trees?
+ * Optionally, check only for no-arg ctor invocation
*/
! public static Name getConstructorInvocationName(List<? extends JCTree> trees, Names names, boolean argsAllowed) {
for (JCTree tree : trees) {
if (tree.hasTag(EXEC)) {
JCExpressionStatement stat = (JCExpressionStatement)tree;
if (stat.expr.hasTag(APPLY)) {
JCMethodInvocation apply = (JCMethodInvocation)stat.expr;
! if (argsAllowed || apply.args.size() == 0) {
! Name methName = TreeInfo.name(apply.meth);
! if (methName == names._this ||
! methName == names._super) {
+ return methName;
+ }
}
}
}
}
return names.empty;
return node.mods.pos;
break;
}
case CONDEXPR:
return getStartPos(((JCConditional) tree).cond);
+ case DEFAULT_VALUE:
+ return getStartPos(((JCDefaultValue) tree).clazz);
case EXEC:
return getStartPos(((JCExpressionStatement) tree).expr);
case INDEXED:
return getStartPos(((JCArrayAccess) tree).indexed);
case METHODDEF: {
return getEndPos(((JCWildcard) tree).inner, endPosTable);
case TYPECAST:
return getEndPos(((JCTypeCast) tree).expr, endPosTable);
case TYPETEST:
return getEndPos(((JCInstanceOf) tree).pattern, endPosTable);
+ case WITHFIELD:
+ return getEndPos(((JCWithField) tree).value, endPosTable);
case WHILELOOP:
return getEndPos(((JCWhileLoop) tree).body, endPosTable);
case ANNOTATED_TYPE:
return getEndPos(((JCAnnotatedType) tree).underlyingType, endPosTable);
case PARENTHESIZEDPATTERN: {
< prev index next >