use of lombok.javac.JavacTreeMaker.TypeTag in project lombok by rzwitserloot.
the class TreeMirrorMaker method visitVariable.
// Monitor issue 205 and issue 694 when making changes here.
@Override
public JCTree visitVariable(VariableTree node, Void p) {
JCVariableDecl original = node instanceof JCVariableDecl ? (JCVariableDecl) node : null;
JCVariableDecl copy = (JCVariableDecl) super.visitVariable(node, p);
if (original == null)
return copy;
copy.sym = original.sym;
if (copy.sym != null)
copy.type = original.type;
if (copy.type != null) {
boolean wipeSymAndType = copy.type.isErroneous();
if (!wipeSymAndType) {
TypeTag typeTag = TypeTag.typeTag(copy.type);
wipeSymAndType = (CTC_NONE.equals(typeTag) || CTC_ERROR.equals(typeTag) || CTC_UNKNOWN.equals(typeTag) || CTC_UNDETVAR.equals(typeTag));
}
if (wipeSymAndType) {
copy.sym = null;
copy.type = null;
}
}
return copy;
}
Aggregations